original_string: protected function detectReferrerSearchEngine()
      {
          $cache    = \Piwik\Cache::getTransientCache();
          $cacheKey = 'cachedReferrerSearchEngine';
  
          $cachedReferrerSearchEngine = [];
          if ($cache->contains($cacheKey)) {
              $cachedReferrerSearchEngine = $cache->fetch($cacheKey);
          }
  
          if (isset($cachedReferrerSearchEngine[$this->referrerUrl])) {
              $searchEngineInformation = $cachedReferrerSearchEngine[$this->referrerUrl];
          } else {
              $searchEngineInformation = SearchEngineDetection::getInstance()->extractInformationFromUrl($this->referrerUrl);
  
              /**
               * Triggered when detecting the search engine of a referrer URL.
               *
               * Plugins can use this event to provide custom search engine detection
               * logic.
               *
               * @param array &$searchEngineInformation An array with the following information:
               *
               *                                        - **name**: The search engine name.
               *                                        - **keywords**: The search keywords used.
               *
               *                                        This parameter is initialized to the results
               *                                        of Piwik's default search engine detection
               *                                        logic.
               * @param string referrerUrl The referrer URL from the tracking request.
               */
              Piwik::postEvent('Tracker.detectReferrerSearchEngine', array(&$searchEngineInformation, $this->referrerUrl));
  
              $cachedReferrerSearchEngine[$this->referrerUrl] = $searchEngineInformation;
              $cache->save($cacheKey, $cachedReferrerSearchEngine);
          }
  
          if ($searchEngineInformation === false) {
              return false;
          }
  
          $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_SEARCH_ENGINE;
          $this->nameReferrerAnalyzed = $searchEngineInformation['name'];
          $this->keywordReferrerAnalyzed = $searchEngineInformation['keywords'];
          return true;
      }
code: protected function detectReferrerSearchEngine()
      {
          $cache    = \Piwik\Cache::getTransientCache();
          $cacheKey = 'cachedReferrerSearchEngine';
  
          $cachedReferrerSearchEngine = [];
          if ($cache->contains($cacheKey)) {
              $cachedReferrerSearchEngine = $cache->fetch($cacheKey);
          }
  
          if (isset($cachedReferrerSearchEngine[$this->referrerUrl])) {
              $searchEngineInformation = $cachedReferrerSearchEngine[$this->referrerUrl];
          } else {
              $searchEngineInformation = SearchEngineDetection::getInstance()->extractInformationFromUrl($this->referrerUrl);
  
              /**
               * Triggered when detecting the search engine of a referrer URL.
               *
               * Plugins can use this event to provide custom search engine detection
               * logic.
               *
               * @param array &$searchEngineInformation An array with the following information:
               *
               *                                        - **name**: The search engine name.
               *                                        - **keywords**: The search keywords used.
               *
               *                                        This parameter is initialized to the results
               *                                        of Piwik's default search engine detection
               *                                        logic.
               * @param string referrerUrl The referrer URL from the tracking request.
               */
              Piwik::postEvent('Tracker.detectReferrerSearchEngine', array(&$searchEngineInformation, $this->referrerUrl));
  
              $cachedReferrerSearchEngine[$this->referrerUrl] = $searchEngineInformation;
              $cache->save($cacheKey, $cachedReferrerSearchEngine);
          }
  
          if ($searchEngineInformation === false) {
              return false;
          }
  
          $this->typeReferrerAnalyzed = Common::REFERRER_TYPE_SEARCH_ENGINE;
          $this->nameReferrerAnalyzed = $searchEngineInformation['name'];
          $this->keywordReferrerAnalyzed = $searchEngineInformation['keywords'];
          return true;
      }
code_tokens: protected function detectReferrerSearchEngine ( ) { $ cache = \ Piwik \ Cache :: getTransientCache ( ) ; $ cacheKey = 'cachedReferrerSearchEngine' ; $ cachedReferrerSearchEngine = [ ] ; if ( $ cache -> contains ( $ cacheKey ) ) { $ cachedReferrerSearchEngine = $ cache -> fetch ( $ cacheKey ) ; } if ( isset ( $ cachedReferrerSearchEngine [ $ this -> referrerUrl ] ) ) { $ searchEngineInformation = $ cachedReferrerSearchEngine [ $ this -> referrerUrl ] ; } else { $ searchEngineInformation = SearchEngineDetection :: getInstance ( ) -> extractInformationFromUrl ( $ this -> referrerUrl ) ; /**
               * Triggered when detecting the search engine of a referrer URL.
               *
               * Plugins can use this event to provide custom search engine detection
               * logic.
               *
               * @param array &$searchEngineInformation An array with the following information:
               *
               *                                        - **name**: The search engine name.
               *                                        - **keywords**: The search keywords used.
               *
               *                                        This parameter is initialized to the results
               *                                        of Piwik's default search engine detection
               *                                        logic.
               * @param string referrerUrl The referrer URL from the tracking request.
               */ Piwik :: postEvent ( 'Tracker.detectReferrerSearchEngine' , array ( & $ searchEngineInformation , $ this -> referrerUrl ) ) ; $ cachedReferrerSearchEngine [ $ this -> referrerUrl ] = $ searchEngineInformation ; $ cache -> save ( $ cacheKey , $ cachedReferrerSearchEngine ) ; } if ( $ searchEngineInformation === false ) { return false ; } $ this -> typeReferrerAnalyzed = Common :: REFERRER_TYPE_SEARCH_ENGINE ; $ this -> nameReferrerAnalyzed = $ searchEngineInformation [ 'name' ] ; $ this -> keywordReferrerAnalyzed = $ searchEngineInformation [ 'keywords' ] ; return true ; }
docstring: Search engine detection
  @return bool
docstring_tokens: Search engine detection