| Conditions | 3 |
| Paths | 1 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | protected function lookup() |
||
| 13 | { |
||
| 14 | $url = sprintf(self::$lookupUrl, $this->storeId); |
||
| 15 | |||
| 16 | $client = new CrawlerClient(); |
||
| 17 | $crawler = $client->request('GET', $url); |
||
| 18 | |||
| 19 | $this->name = $crawler->filter('[itemprop="name"]')->text(); |
||
| 20 | |||
| 21 | $crawler->filter('div.score-container meta')->each(function ($node) { |
||
| 22 | switch ($node->attr('itemprop')) { |
||
| 23 | case 'ratingValue': |
||
| 24 | $this->ratingStars = round($node->attr('content')); |
||
|
|
|||
| 25 | break; |
||
| 26 | case 'ratingCount': |
||
| 27 | $this->ratingCount = $node->attr('content'); |
||
| 28 | } |
||
| 29 | }); |
||
| 30 | |||
| 31 | // $this->contentRating = $crawler->filter('[itemprop="contentRating"]')->text(); |
||
| 32 | $iconUrl = $crawler->filter('[itemprop="image"]')->attr('src'); |
||
| 33 | $this->icon = $this->addScheme($iconUrl); |
||
| 34 | |||
| 35 | $crawler->filter('[alt="Screenshot Image"]')->each(function ($node) { |
||
| 36 | $this->screenshots[] = $this->addScheme($node->attr('src')); |
||
| 37 | }); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.