original_string: protected function detectReferrerDirectEntry()
      {
          if (empty($this->referrerHost)) {
              return false;
          }
  
          $urlsByHost = $this->getCachedUrlsByHostAndIdSite();
  
          $directEntry   = new SiteUrls();
          $matchingSites = $directEntry->getIdSitesMatchingUrl($this->referrerUrlParse, $urlsByHost);
  
          if (isset($matchingSites) && is_array($matchingSites) && in_array($this->idsite, $matchingSites)) {
              $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
              return true;
          } elseif (isset($matchingSites)) {
              return false;
          }
  
          $site = Cache::getCacheWebsiteAttributes($this->idsite);
          $excludeUnknowns = $site['exclude_unknown_urls'];
  
          // fallback logic if the referrer domain is not known to any site to not break BC
          if (!$excludeUnknowns && isset($this->currentUrlParse['host'])) {
              // this might be actually buggy if first thing tracked is eg an outlink and referrer is from that site
              $currentHost = Common::mb_strtolower($this->currentUrlParse['host']);
              if ($currentHost == Common::mb_strtolower($this->referrerHost)) {
                  $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
                  return true;
              }
          }
  
          return false;
      }
code: protected function detectReferrerDirectEntry()
      {
          if (empty($this->referrerHost)) {
              return false;
          }
  
          $urlsByHost = $this->getCachedUrlsByHostAndIdSite();
  
          $directEntry   = new SiteUrls();
          $matchingSites = $directEntry->getIdSitesMatchingUrl($this->referrerUrlParse, $urlsByHost);
  
          if (isset($matchingSites) && is_array($matchingSites) && in_array($this->idsite, $matchingSites)) {
              $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
              return true;
          } elseif (isset($matchingSites)) {
              return false;
          }
  
          $site = Cache::getCacheWebsiteAttributes($this->idsite);
          $excludeUnknowns = $site['exclude_unknown_urls'];
  
          // fallback logic if the referrer domain is not known to any site to not break BC
          if (!$excludeUnknowns && isset($this->currentUrlParse['host'])) {
              // this might be actually buggy if first thing tracked is eg an outlink and referrer is from that site
              $currentHost = Common::mb_strtolower($this->currentUrlParse['host']);
              if ($currentHost == Common::mb_strtolower($this->referrerHost)) {
                  $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_DIRECT_ENTRY;
                  return true;
              }
          }
  
          return false;
      }
code_tokens: protected function detectReferrerDirectEntry ( ) { if ( empty ( $ this -> referrerHost ) ) { return false ; } $ urlsByHost = $ this -> getCachedUrlsByHostAndIdSite ( ) ; $ directEntry = new SiteUrls ( ) ; $ matchingSites = $ directEntry -> getIdSitesMatchingUrl ( $ this -> referrerUrlParse , $ urlsByHost ) ; if ( isset ( $ matchingSites ) && is_array ( $ matchingSites ) && in_array ( $ this -> idsite , $ matchingSites ) ) { $ this -> typeReferrerAnalyzed = Common :: REFERRER_TYPE_DIRECT_ENTRY ; return true ; } elseif ( isset ( $ matchingSites ) ) { return false ; } $ site = Cache :: getCacheWebsiteAttributes ( $ this -> idsite ) ; $ excludeUnknowns = $ site [ 'exclude_unknown_urls' ] ; // fallback logic if the referrer domain is not known to any site to not break BC if ( ! $ excludeUnknowns && isset ( $ this -> currentUrlParse [ 'host' ] ) ) { // this might be actually buggy if first thing tracked is eg an outlink and referrer is from that site $ currentHost = Common :: mb_strtolower ( $ this -> currentUrlParse [ 'host' ] ) ; if ( $ currentHost == Common :: mb_strtolower ( $ this -> referrerHost ) ) { $ this -> typeReferrerAnalyzed = Common :: REFERRER_TYPE_DIRECT_ENTRY ; return true ; } } return false ; }
docstring: We have previously tried to detect the campaign variables in the URL
  so at this stage, if the referrer host is the current host,
  or if the referrer host is any of the registered URL for this website,
  it is considered a direct entry
  @return bool
docstring_tokens: We have previously tried to detect the campaign variables in the URL so at this stage if the referrer host is the current host or if the referrer host is any of the registered URL for this website it is considered a direct entry