| Conditions | 5 |
| Paths | 6 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function __invoke(ResponseInterface $response, $index) |
||
| 12 | { |
||
| 13 | $robots = new CrawlerRobots($response, $this->crawler->mustRespectRobots()); |
||
| 14 | |||
| 15 | if (! $robots->mayIndex()) { |
||
| 16 | return; |
||
| 17 | } |
||
| 18 | |||
| 19 | $crawlUrl = $this->crawler->getCrawlQueue()->getUrlById($index); |
||
| 20 | |||
| 21 | $this->handleCrawled($response, $crawlUrl); |
||
| 22 | |||
| 23 | if (! $this->crawler->getCrawlProfile() instanceof CrawlSubdomains) { |
||
| 24 | if ($crawlUrl->url->getHost() !== $this->crawler->getBaseUrl()->getHost()) { |
||
| 25 | return; |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | if (! $robots->mayFollow()) { |
||
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | $body = $this->convertBodyToString($response->getBody(), $this->crawler->getMaximumResponseSize()); |
||
| 34 | |||
| 35 | $this->linkAdder->addFromHtml($body, $crawlUrl->url); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |