| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | protected function lookup() |
||
| 13 | { |
||
| 14 | $url = sprintf(self::$lookupUrl, $this->country, $this->storeId); |
||
| 15 | |||
| 16 | $client = new HttpClient(); |
||
| 17 | $response = $client->get($url); |
||
| 18 | $data = array_get(json_decode($response->getBody(), true), 'results.0'); |
||
| 19 | $this->name = array_get($data, 'trackCensoredName'); |
||
| 20 | $this->icon = array_get($data, 'artworkUrl512'); |
||
| 21 | $this->screenshots = array_merge(array_get($data, 'ipadScreenshotUrls', []), array_get($data, 'screenshotUrls', [])); |
||
| 22 | $this->ratingStars = round(array_get($data, 'averageUserRating', 0)); |
||
|
|
|||
| 23 | $this->ratingCount = array_get($data, 'userRatingCount', 0); |
||
| 24 | $this->contentRating = array_get($data, 'contentAdvisoryRating', ''); |
||
| 25 | |||
| 26 | return $data; |
||
| 27 | } |
||
| 28 | } |
||
| 29 |
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.