| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 2 | public function getAverageData(Crawler $htmlCrawler): float |
|
| 26 | { |
||
| 27 | 2 | $mileageNode = $htmlCrawler->filter(self::HTML_MILEAGE_SELECTOR)->first()->getNode(0); |
|
| 28 | 2 | if ($mileageNode) { |
|
| 29 | 1 | $mileageNodeText = $mileageNode->textContent; |
|
| 30 | } else { |
||
| 31 | 1 | $mileageNodeText = '1'; |
|
| 32 | } |
||
| 33 | |||
| 34 | 2 | $mileage = str_replace(' ', '', rtrim(trim($mileageNodeText), 'km')); |
|
| 35 | 2 | return (float)$mileage; |
|
| 36 | } |
||
| 38 |