@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getUrl(): string |
101 | 101 | { |
102 | - return GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query( |
|
102 | + return GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query( |
|
103 | 103 | [ |
104 | 104 | GPlayApps::REQ_PARAM_ID => $this->id, |
105 | 105 | ] |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getFullUrl(): string |
117 | 117 | { |
118 | - return GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query( |
|
118 | + return GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query( |
|
119 | 119 | [ |
120 | 120 | GPlayApps::REQ_PARAM_ID => $this->id, |
121 | 121 | GPlayApps::REQ_PARAM_LOCALE => $this->locale, |
@@ -82,21 +82,21 @@ |
||
82 | 82 | |
83 | 83 | if (empty($this->id)) { |
84 | 84 | throw new \InvalidArgumentException( |
85 | - 'Developer id cannot be null or empty. ' . |
|
85 | + 'Developer id cannot be null or empty. '. |
|
86 | 86 | 'Solution: $developerBuilder->setId(...);' |
87 | 87 | ); |
88 | 88 | } |
89 | 89 | |
90 | 90 | if (empty($this->url)) { |
91 | 91 | throw new \InvalidArgumentException( |
92 | - 'Developer url cannot be null or empty. ' . |
|
92 | + 'Developer url cannot be null or empty. '. |
|
93 | 93 | 'Solution: $developerBuilder->setUrl(...);' |
94 | 94 | ); |
95 | 95 | } |
96 | 96 | |
97 | 97 | if (empty($this->name)) { |
98 | 98 | throw new \InvalidArgumentException( |
99 | - 'Developer name cannot be null or empty. ' . |
|
99 | + 'Developer name cannot be null or empty. '. |
|
100 | 100 | 'Solution: $developerBuilder->setName(...);' |
101 | 101 | ); |
102 | 102 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } |
192 | 192 | $parts = \array_slice($parts, 0, 4); |
193 | 193 | $path = implode('/', $parts); |
194 | - $url = $httpComponents['scheme'] . '://' . $httpComponents['host'] . '/' . $path . '/'; |
|
194 | + $url = $httpComponents['scheme'].'://'.$httpComponents['host'].'/'.$path.'/'; |
|
195 | 195 | $this->variantOfUrlWithFileName = true; |
196 | 196 | } elseif (($pos = strpos($url, '=')) !== false) { |
197 | 197 | $paramString = substr($url, $pos + 1); |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | $params = []; |
273 | 273 | |
274 | 274 | if ($this->size !== null) { |
275 | - $params[] = self::PARAM_SIZE . $this->size; |
|
275 | + $params[] = self::PARAM_SIZE.$this->size; |
|
276 | 276 | } else { |
277 | 277 | if ($this->width !== null) { |
278 | - $params[] = self::PARAM_WIDTH . $this->width; |
|
278 | + $params[] = self::PARAM_WIDTH.$this->width; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | if ($this->height !== null) { |
282 | - $params[] = self::PARAM_HEIGHT . $this->height; |
|
282 | + $params[] = self::PARAM_HEIGHT.$this->height; |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | return $this->baseUrl; |
295 | 295 | } |
296 | 296 | |
297 | - return $this->baseUrl . implode('-', $params) . '/'; |
|
297 | + return $this->baseUrl.implode('-', $params).'/'; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | if ($this->border !== null) { |
301 | - $params[] = self::PARAM_BORDER . $this->border; |
|
301 | + $params[] = self::PARAM_BORDER.$this->border; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | if ($this->verticalFlip) { |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | return $this->baseUrl; |
314 | 314 | } |
315 | 315 | |
316 | - return $this->baseUrl . '=' . implode('-', $params); |
|
316 | + return $this->baseUrl.'='.implode('-', $params); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -335,13 +335,13 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public function getOriginalSizeUrl(): string |
337 | 337 | { |
338 | - $params = [self::PARAM_SIZE . '0']; |
|
338 | + $params = [self::PARAM_SIZE.'0']; |
|
339 | 339 | |
340 | 340 | if ($this->variantOfUrlWithFileName) { |
341 | - return $this->baseUrl . implode('-', $params) . '/'; |
|
341 | + return $this->baseUrl.implode('-', $params).'/'; |
|
342 | 342 | } |
343 | 343 | |
344 | - return $this->baseUrl . '=' . implode('-', $params); |
|
344 | + return $this->baseUrl.'='.implode('-', $params); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | for ($i = 0; $i < $parts; $i++) { |
367 | 367 | $partsBuild[] = substr($hash, $i * $partLength, $partLength); |
368 | 368 | } |
369 | - $hash = implode('/', $partsBuild) . '/' . $hash; |
|
369 | + $hash = implode('/', $partsBuild).'/'.$hash; |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | return $hash; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | RequestOptions::COOKIES => null, |
632 | 632 | RequestOptions::HTTP_ERRORS => true, |
633 | 633 | RequestOptions::SINK => $stream, |
634 | - RequestOptions::ON_HEADERS => static function (ResponseInterface $response) use ( |
|
634 | + RequestOptions::ON_HEADERS => static function(ResponseInterface $response) use ( |
|
635 | 635 | $url, |
636 | 636 | $stream |
637 | 637 | ): void { |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | $contentType = $response->getHeaderLine('Content-Type'); |
669 | 669 | |
670 | 670 | if (!preg_match('~\bimage/.*\b~i', $contentType, $match)) { |
671 | - throw new GooglePlayException('Url ' . $url . ' is not image'); |
|
671 | + throw new GooglePlayException('Url '.$url.' is not image'); |
|
672 | 672 | } |
673 | 673 | $contentType = $match[0]; |
674 | 674 | $imageType = self::getImageExtension($contentType); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $imageInfo = getimagesize($filename); |
52 | 52 | |
53 | 53 | if (!$imageInfo) { |
54 | - throw new \RuntimeException('Invalid image: ' . $filename); |
|
54 | + throw new \RuntimeException('Invalid image: '.$filename); |
|
55 | 55 | } |
56 | 56 | $this->filename = $filename; |
57 | 57 | $this->mimeType = $imageInfo['mime']; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | $diff = array_udiff( |
520 | 520 | $otherApp->screenshots, |
521 | 521 | $this->screenshots, |
522 | - static function (GoogleImage $a, GoogleImage $b) { |
|
522 | + static function(GoogleImage $a, GoogleImage $b) { |
|
523 | 523 | return strcmp($a->getOriginalSizeUrl(), $b->getOriginalSizeUrl()); |
524 | 524 | } |
525 | 525 | ); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | $array['translatedFromLocale'] = $this->translatedFromLocale; |
540 | 540 | $array['cover'] = $this->cover !== null ? $this->cover->getUrl() : null; |
541 | 541 | $array['screenshots'] = array_map( |
542 | - static function (GoogleImage $googleImage) { |
|
542 | + static function(GoogleImage $googleImage) { |
|
543 | 543 | return $googleImage->getUrl(); |
544 | 544 | }, |
545 | 545 | $this->screenshots |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | $array['updatedTimestamp'] = $this->updated !== null ? $this->updated->getTimestamp() : 0; |
570 | 570 | $array['numberReviews'] = $this->numberReviews; |
571 | 571 | $array['reviews'] = array_map( |
572 | - static function (Review $review) { |
|
572 | + static function(Review $review) { |
|
573 | 573 | return $review->asArray(); |
574 | 574 | }, |
575 | 575 | $this->reviews |
@@ -1190,8 +1190,8 @@ discard block |
||
1190 | 1190 | if (isset($datePatternObj['months'])) { |
1191 | 1191 | if (!isset($datePatternObj['months'][$month])) { |
1192 | 1192 | throw new \RuntimeException( |
1193 | - 'Error convert date. Locale ' . $locale . '. Date: ' . $dateText . |
|
1194 | - '. Matches: ' . var_export($match, true) |
|
1193 | + 'Error convert date. Locale '.$locale.'. Date: '.$dateText. |
|
1194 | + '. Matches: '.var_export($match, true) |
|
1195 | 1195 | ); |
1196 | 1196 | } |
1197 | 1197 | $month = $datePatternObj['months'][$month]; |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | |
1204 | 1204 | $dateTime = \DateTimeImmutable::createFromFormat( |
1205 | 1205 | 'Y.m.d H:i:s', |
1206 | - $year . '.' . $month . '.' . $day . ' 00:00:00', |
|
1206 | + $year.'.'.$month.'.'.$day.' 00:00:00', |
|
1207 | 1207 | new \DateTimeZone('UTC') |
1208 | 1208 | ); |
1209 | 1209 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if (preg_match_all('/>AF_initDataCallback[\s\S]*?<\/script/', $html, $matches)) { |
29 | 29 | $scripts = array_reduce( |
30 | 30 | $matches[0], |
31 | - static function ($carry, $item) { |
|
31 | + static function($carry, $item) { |
|
32 | 32 | if ( |
33 | 33 | preg_match("/(ds:.*?)'/", $item, $keyMatch) && |
34 | 34 | preg_match('/data:([\s\S]*?)}\);<\//', $item, $valueMatch) |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | $doc = new \DOMDocument(); |
56 | 56 | $internalErrors = libxml_use_internal_errors(true); |
57 | 57 | |
58 | - if (!$doc->loadHTML('<?xml encoding="utf-8"?>' . $html)) { |
|
58 | + if (!$doc->loadHTML('<?xml encoding="utf-8"?>'.$html)) { |
|
59 | 59 | throw new |
60 | 60 | \RuntimeException( |
61 | - 'error load html: ' . $html |
|
61 | + 'error load html: '.$html |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | libxml_use_internal_errors($internalErrors); |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | case 'p': |
109 | 109 | case 'ul': |
110 | 110 | case 'div': |
111 | - $text = "\n\n" . $text . "\n\n"; |
|
111 | + $text = "\n\n".$text."\n\n"; |
|
112 | 112 | break; |
113 | 113 | |
114 | 114 | case 'li': |
115 | - $text = '- ' . $text . "\n"; |
|
115 | + $text = '- '.$text."\n"; |
|
116 | 116 | break; |
117 | 117 | |
118 | 118 | case 'br': |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | if (isset($scriptDataInfo[0][12][13][0][0])) { |
69 | 69 | $category = $this->extractCategory($scriptDataInfo[0][12][13][0]); |
70 | 70 | } |
71 | - elseif (!empty($data[0][12][13][25])){ |
|
71 | + elseif (!empty($data[0][12][13][25])) { |
|
72 | 72 | $genreId = (string) $data[0][12][13][25]; |
73 | - $genreName = ucwords(strtolower(str_replace(['_', 'AND'],[' ', '&'], $genreId))); |
|
73 | + $genreName = ucwords(strtolower(str_replace(['_', 'AND'], [' ', '&'], $genreId))); |
|
74 | 74 | $category = new Category($genreId, $genreName); |
75 | 75 | } |
76 | - else{ |
|
76 | + else { |
|
77 | 77 | $category = null; |
78 | 78 | } |
79 | 79 | $summary = $this->extractSummary($scriptDataInfo); |
@@ -223,8 +223,7 @@ discard block |
||
223 | 223 | LocaleHelper::findPreferredLanguage( |
224 | 224 | $locale, |
225 | 225 | $scriptDataInfo[0][19][1] |
226 | - ) : |
|
227 | - null; |
|
226 | + ) : null; |
|
228 | 227 | } |
229 | 228 | |
230 | 229 | /** |
@@ -260,7 +259,7 @@ discard block |
||
260 | 259 | */ |
261 | 260 | private function extractDeveloper(array $scriptDataInfo): Developer |
262 | 261 | { |
263 | - $developerPage = GPlayApps::GOOGLE_PLAY_URL . $scriptDataInfo[0][12][5][5][4][2]; |
|
262 | + $developerPage = GPlayApps::GOOGLE_PLAY_URL.$scriptDataInfo[0][12][5][5][4][2]; |
|
264 | 263 | $developerId = parse_query(parse_url($developerPage, \PHP_URL_QUERY))[GPlayApps::REQ_PARAM_ID]; |
265 | 264 | $developerName = $scriptDataInfo[0][12][5][1]; |
266 | 265 | $developerEmail = $scriptDataInfo[0][12][5][2][0] ?? null; |
@@ -320,8 +319,7 @@ discard block |
||
320 | 319 | protected function extractPrice(array $scriptDataPrice): ?float |
321 | 320 | { |
322 | 321 | return isset($scriptDataPrice[0][2][0][0][0][1][0][0]) ? |
323 | - (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : |
|
324 | - 0.0; |
|
322 | + (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : 0.0; |
|
325 | 323 | } |
326 | 324 | |
327 | 325 | /** |
@@ -356,7 +354,7 @@ discard block |
||
356 | 354 | private function extractScreenshots(array $scriptDataInfo): array |
357 | 355 | { |
358 | 356 | return !empty($scriptDataInfo[0][12][0]) ? array_map( |
359 | - static function (array $v) { |
|
357 | + static function(array $v) { |
|
360 | 358 | return new GoogleImage($v[3][2]); |
361 | 359 | }, |
362 | 360 | $scriptDataInfo[0][12][0] |
@@ -67,13 +67,11 @@ |
||
67 | 67 | $developer = $this->extractDeveloper($scriptDataInfo); |
68 | 68 | if (isset($scriptDataInfo[0][12][13][0][0])) { |
69 | 69 | $category = $this->extractCategory($scriptDataInfo[0][12][13][0]); |
70 | - } |
|
71 | - elseif (!empty($data[0][12][13][25])){ |
|
70 | + } elseif (!empty($data[0][12][13][25])){ |
|
72 | 71 | $genreId = (string) $data[0][12][13][25]; |
73 | 72 | $genreName = ucwords(strtolower(str_replace(['_', 'AND'],[' ', '&'], $genreId))); |
74 | 73 | $category = new Category($genreId, $genreName); |
75 | - } |
|
76 | - else{ |
|
74 | + } else{ |
|
77 | 75 | $category = null; |
78 | 76 | } |
79 | 77 | $summary = $this->extractSummary($scriptDataInfo); |