Spatie\Crawler\CrawlObserver::willCrawl PHP 메소드

willCrawl() 공개 메소드

Called when the crawler will crawl the url.
public willCrawl ( Url $url ) : void
$url Url
리턴 void
    public function willCrawl(Url $url);

Usage Example

예제 #1
0
파일: Crawler.php 프로젝트: spatie/crawler
 protected function getCrawlRequests() : Generator
 {
     $i = 0;
     while ($crawlUrl = $this->crawlQueue->getPendingUrlAtIndex($i)) {
         if (!$this->crawlProfile->shouldCrawl($crawlUrl->url)) {
             $i++;
             continue;
         }
         if ($this->crawlQueue->hasAlreadyBeenProcessed($crawlUrl)) {
             $i++;
             continue;
         }
         $this->crawlObserver->willCrawl($crawlUrl->url);
         $this->crawlQueue->markAsProcessed($crawlUrl);
         (yield new Request('GET', (string) $crawlUrl->url));
         $i++;
     }
 }
All Usage Examples Of Spatie\Crawler\CrawlObserver::willCrawl