| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 1 | public function getAverageData(Crawler $htmlCrawler): float |
|
| 29 | { |
||
| 30 | 1 | $priceValueNode = $htmlCrawler->filter(self::HTML_PRICE_SELECTOR)->first()->getNode(0); |
|
| 31 | 1 | $priceValueNodeText = $priceValueNode->textContent; |
|
| 32 | 1 | $price = (float)str_replace(' ', '', trim($priceValueNodeText)); |
|
| 33 | |||
| 34 | 1 | $priceDetailsNode = $htmlCrawler->filter(self::HTML_PRICE_DETAILS_SELECTOR)->first()->getNode(0); |
|
| 35 | 1 | $priceValueNodeText = $priceDetailsNode->textContent; |
|
| 36 | 1 | if (strpos($priceValueNodeText, self::HTML_PRICE_NET_SYMBOL) !== false) { |
|
| 37 | 1 | $price = $price * self::CAR_PRICE_TAX; |
|
| 38 | } |
||
| 39 | |||
| 40 | 1 | return $price; |
|
| 41 | } |
||
| 43 |