1 | <?php |
||
10 | class Observer extends CrawlObserver |
||
11 | { |
||
12 | /** @var callable */ |
||
13 | protected $hasCrawled; |
||
14 | |||
15 | public function __construct(callable $hasCrawled) |
||
19 | |||
20 | /** |
||
21 | * Called when the crawler will crawl the url. |
||
22 | * |
||
23 | * @param \Psr\Http\Message\UriInterface $url |
||
24 | */ |
||
25 | public function willCrawl(UriInterface $url) |
||
28 | |||
29 | /** |
||
30 | * Called when the crawl has ended. |
||
31 | */ |
||
32 | public function finishedCrawling() |
||
35 | |||
36 | /** |
||
37 | * Called when the crawler has crawled the given url successfully. |
||
38 | * |
||
39 | * @param \Psr\Http\Message\UriInterface $url |
||
40 | * @param \Psr\Http\Message\ResponseInterface $response |
||
41 | * @param \Psr\Http\Message\UriInterface|null $foundOnUrl |
||
42 | */ |
||
43 | public function crawled( |
||
50 | |||
51 | /** |
||
52 | * Called when the crawler had a problem crawling the given url. |
||
53 | * |
||
54 | * @param \Psr\Http\Message\UriInterface $url |
||
55 | * @param \GuzzleHttp\Exception\RequestException $requestException |
||
56 | * @param \Psr\Http\Message\UriInterface|null $foundOnUrl |
||
57 | */ |
||
58 | public function crawlFailed( |
||
65 | } |
||
66 |