| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 4 | public function crawl(HttpClientInterface $httpClient, Symbol $symbol): Site |
|
| 29 | { |
||
| 30 | 4 | $symbol = mb_strtolower($symbol->toString()); |
|
| 31 | 4 | $url = sprintf(self::REQUEST_URL, $symbol); |
|
| 32 | |||
| 33 | $html = $httpClient |
||
| 34 | 4 | ->request(self::REQUEST_METHOD, $url, $this->buildRequestHeaders()) |
|
| 35 | 4 | ->getContent($throw = false); |
|
| 36 | |||
| 37 | 4 | $crawled = []; |
|
| 38 | |||
| 39 | 4 | foreach ($this->crawlers as $name => $crawler) { |
|
| 40 | 4 | $crawled[$name] = $crawler->crawlHtml($html); |
|
| 41 | } |
||
| 42 | |||
| 43 | 4 | return new Site($crawled); |
|
| 44 | } |
||
| 55 |