protected function setUp()
 {
     $engines = array('google', 'bing', 'yahoo', 'ask');
     $offsets = array(0, 1, 2, 3, 4, 5, 6);
     $keywords = array(Validator::processKeyword('foobar'), Validator::processKeyword('foo'), Validator::processKeyword('foo baz  ?  \\/  <>'), Validator::processKeyword('\\n\\t/   <a>'));
     $this->settings = array('engines' => $engines, 'offsets' => $offsets, 'keywords' => $keywords);
 }
Ejemplo n.º 2
0
 /**
  * Add a keyword to scrape. Update Throttler object accordingly.
  * @param   string $keyword
  * @return  string
  */
 public function addKeyword($keyword)
 {
     if (KeywordValidator::isValid($keyword) && !SerpScraperHelper::keywordPresent($keyword, $this->keywords)) {
         $cleanKeyword = KeywordValidator::processKeyword($keyword);
         array_push($this->keywords, $cleanKeyword);
         $this->throttler->stop();
         $this->throttler->addComponents($cleanKeyword);
         $this->throttler->resume();
         return true;
     }
     return false;
 }