/**
  * Check for valid scraping args.
  * @param  array  $keywords
  * @param  int    $pagesToScrape
  * @param  bool   $toRemove
  * @param  string $timezone
  * @param  bool   $throttling
  * @param  array  $trackingKeywords
  * @return bool
  */
 public static function validScrapeArgs($keywords, $pagesToScrape, $toRemove, $timezone, $throttling, $trackingKeywords)
 {
     return \Franzip\SerpScraper\Helpers\KeywordValidator::validKeywords($keywords) && self::keywordsAllTracked($keywords, $trackingKeywords) && is_int($pagesToScrape) && $pagesToScrape > 0 && is_bool($toRemove) && in_array($timezone, \DateTimeZone::listIdentifiers()) && is_bool($throttling);
 }
Exemple #2
0
 /**
  * Add multiple keywords to scrape.
  * @param   array $keywords
  * @return  bool
  */
 public function addKeywords($keywords)
 {
     if (KeywordValidator::validKeywords($keywords) && !empty($keywords)) {
         for ($i = 0; $i < count($keywords); $i++) {
             $this->addKeyword($keywords[$i]);
         }
         return true;
     }
     return false;
 }