@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - private $mileages = []; |
|
| 43 | + private $mileages = [ ]; |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @var array |
| 47 | 47 | */ |
| 48 | - private $prices = []; |
|
| 48 | + private $prices = [ ]; |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @var array |
| 52 | 52 | */ |
| 53 | - private $years = []; |
|
| 53 | + private $years = [ ]; |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * StatsHtmlScrapper constructor. |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | $crawler = new Crawler($html); |
| 78 | 78 | $carInstances = $crawler->filter(self::HTML_OFFER_SELECTOR); |
| 79 | 79 | |
| 80 | - $carInstances->each(function (Crawler $crawler) use (&$mileages, &$prices, &$years) { |
|
| 81 | - $this->mileages[] = $this->mileageScrapper->getAverageData($crawler); |
|
| 82 | - $this->prices[] = $this->priceScrapper->getAverageData($crawler); |
|
| 83 | - $this->years[] = $this->yearScrapper->getAverageData($crawler); |
|
| 80 | + $carInstances->each(function(Crawler $crawler) use (&$mileages, &$prices, &$years) { |
|
| 81 | + $this->mileages[ ] = $this->mileageScrapper->getAverageData($crawler); |
|
| 82 | + $this->prices[ ] = $this->priceScrapper->getAverageData($crawler); |
|
| 83 | + $this->years[ ] = $this->yearScrapper->getAverageData($crawler); |
|
| 84 | 84 | }); |
| 85 | 85 | |
| 86 | 86 | $stats = $this->getAverageStats($this->mileages, $this->prices, $this->years); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $priceValueNode = $htmlCrawler->filter(self::HTML_PRICE_SELECTOR)->first()->getNode(0); |
| 31 | 31 | $priceValueNodeText = $priceValueNode->textContent; |
| 32 | - $price = (float)str_replace(' ', '', trim($priceValueNodeText)); |
|
| 32 | + $price = (float) str_replace(' ', '', trim($priceValueNodeText)); |
|
| 33 | 33 | |
| 34 | 34 | $priceDetailsNode = $htmlCrawler->filter(self::HTML_PRICE_DETAILS_SELECTOR)->first()->getNode(0); |
| 35 | 35 | $priceValueNodeText = $priceDetailsNode->textContent; |
@@ -32,6 +32,6 @@ |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $mileage = str_replace(' ', '', rtrim(trim($mileageNodeText), 'km')); |
| 35 | - return (float)$mileage; |
|
| 35 | + return (float) $mileage; |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -28,6 +28,6 @@ |
||
| 28 | 28 | $yearNodeText = $yearNode->textContent; |
| 29 | 29 | |
| 30 | 30 | $year = trim($yearNodeText); |
| 31 | - return (int)$year; |
|
| 31 | + return (int) $year; |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | ->filter(self::HTML_PAGER_SELECTOR) |
| 149 | 149 | ->filter(self::HTML_PAGER_ELEMENT_SELECTOR); |
| 150 | 150 | $lastPagerItem = $pagerListItems->getNode($pagerListItems->count() - 2); |
| 151 | - return $lastPagerItem ? (int)$lastPagerItem->textContent : 0; |
|
| 151 | + return $lastPagerItem ? (int) $lastPagerItem->textContent : 0; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function validate(string $value): void |
| 25 | 25 | { |
| 26 | - $year = (int)$value; |
|
| 26 | + $year = (int) $value; |
|
| 27 | 27 | if ($year < 1900 || $year > 2050) { |
| 28 | 28 | throw new IncorrectFilterValueException("Value {$value} for filter is incorrect"); |
| 29 | 29 | } |
@@ -208,6 +208,6 @@ |
||
| 208 | 208 | $method = $reflection->getMethod('execute'); |
| 209 | 209 | $method->setAccessible(true); |
| 210 | 210 | |
| 211 | - $method->invokeArgs($this->command, [$this->input, $this->output]); |
|
| 211 | + $method->invokeArgs($this->command, [ $this->input, $this->output ]); |
|
| 212 | 212 | } |
| 213 | 213 | } |
@@ -52,6 +52,6 @@ |
||
| 52 | 52 | $modelListNode = $crawler->filter(self::HTML_MODEL_DATA_NODE_SELECTOR)->getNode(0); |
| 53 | 53 | $jsonData = $modelListNode->getAttribute(self::HTML_MODEL_DATA_NODE_ATTRIBUTE); |
| 54 | 54 | $encodedData = json_decode($jsonData, true); |
| 55 | - return $encodedData[self::MODEL_DATA_JSON_KEY]; |
|
| 55 | + return $encodedData[ self::MODEL_DATA_JSON_KEY ]; |
|
| 56 | 56 | } |
| 57 | 57 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | $this->validator->expects($this->exactly(2)) |
| 46 | 46 | ->method('validate') |
| 47 | - ->withConsecutive(['2015'], ['2017']); |
|
| 47 | + ->withConsecutive([ '2015' ], [ '2017' ]); |
|
| 48 | 48 | |
| 49 | 49 | $filter = new FromYearFilter($this->validator, '2015'); |
| 50 | 50 | |