@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | if ($otherApp->getIcon()->getOriginalSizeUrl() !== $this->getIcon()->getOriginalSizeUrl()) { |
| 504 | 504 | return false; |
| 505 | 505 | } |
| 506 | - $diff = array_udiff($otherApp->screenshots, $this->screenshots, static function (GoogleImage $a, GoogleImage $b) { |
|
| 506 | + $diff = array_udiff($otherApp->screenshots, $this->screenshots, static function(GoogleImage $a, GoogleImage $b) { |
|
| 507 | 507 | return strcmp($a->getOriginalSizeUrl(), $b->getOriginalSizeUrl()); |
| 508 | 508 | }); |
| 509 | 509 | return empty($diff); |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | $array['description'] = $this->description; |
| 521 | 521 | $array['translatedFromLocale'] = $this->translatedFromLocale; |
| 522 | 522 | $array['cover'] = $this->cover !== null ? $this->cover->getUrl() : null; |
| 523 | - $array['screenshots'] = array_map(static function (GoogleImage $googleImage) { |
|
| 523 | + $array['screenshots'] = array_map(static function(GoogleImage $googleImage) { |
|
| 524 | 524 | return $googleImage->getUrl(); |
| 525 | 525 | }, $this->screenshots); |
| 526 | 526 | $array['category'] = $this->category->asArray(); |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | $array['updated'] = $this->updated !== null ? $this->updated->format(\DateTimeInterface::RFC3339) : null; |
| 548 | 548 | $array['updatedTimestamp'] = $this->updated !== null ? $this->updated->getTimestamp() : 0; |
| 549 | 549 | $array['numberReviews'] = $this->numberReviews; |
| 550 | - $array['reviews'] = array_map(static function (Review $review) { |
|
| 550 | + $array['reviews'] = array_map(static function(Review $review) { |
|
| 551 | 551 | return $review->asArray(); |
| 552 | 552 | }, $this->reviews); |
| 553 | 553 | return $array; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getUrl(): string |
| 72 | 72 | { |
| 73 | - return GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query([ |
|
| 73 | + return GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query([ |
|
| 74 | 74 | GPlayApps::REQ_PARAM_ID => $this->id, |
| 75 | 75 | ]); |
| 76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getFullUrl(): string |
| 82 | 82 | { |
| 83 | - return GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query([ |
|
| 83 | + return GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query([ |
|
| 84 | 84 | GPlayApps::REQ_PARAM_ID => $this->id, |
| 85 | 85 | GPlayApps::REQ_PARAM_LOCALE => $this->locale, |
| 86 | 86 | GPlayApps::REQ_PARAM_COUNTRY => $this->country, |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $this->url = $url; |
| 49 | 49 | $imageInfo = getimagesize($filename); |
| 50 | 50 | if (!$imageInfo) { |
| 51 | - throw new \RuntimeException('Invalid image: ' . $filename); |
|
| 51 | + throw new \RuntimeException('Invalid image: '.$filename); |
|
| 52 | 52 | } |
| 53 | 53 | $this->filename = $filename; |
| 54 | 54 | $this->mimeType = $imageInfo['mime']; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $scripts = []; |
| 24 | 24 | if (preg_match_all('/>AF_initDataCallback[\s\S]*?<\/script/', $html, $matches)) { |
| 25 | - $scripts = array_reduce($matches[0], static function ($carry, $item) { |
|
| 25 | + $scripts = array_reduce($matches[0], static function($carry, $item) { |
|
| 26 | 26 | if ( |
| 27 | 27 | preg_match("/(ds:.*?)'/", $item, $keyMatch) && |
| 28 | 28 | preg_match('/return ([\s\S]*?)}}\);<\//', $item, $valueMatch) |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $doc = new \DOMDocument(); |
| 45 | 45 | $internalErrors = libxml_use_internal_errors(true); |
| 46 | - if (!$doc->loadHTML('<?xml encoding="utf-8"?>' . $html)) { |
|
| 46 | + if (!$doc->loadHTML('<?xml encoding="utf-8"?>'.$html)) { |
|
| 47 | 47 | throw new |
| 48 | - \RuntimeException('error load html: ' . $html); |
|
| 48 | + \RuntimeException('error load html: '.$html); |
|
| 49 | 49 | } |
| 50 | 50 | libxml_use_internal_errors($internalErrors); |
| 51 | 51 | return $doc; |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | case 'p': |
| 90 | 90 | case 'ul': |
| 91 | 91 | case 'div': |
| 92 | - $text = "\n\n" . $text . "\n\n"; |
|
| 92 | + $text = "\n\n".$text."\n\n"; |
|
| 93 | 93 | break; |
| 94 | 94 | case 'li': |
| 95 | - $text = '- ' . $text . "\n"; |
|
| 95 | + $text = '- '.$text."\n"; |
|
| 96 | 96 | break; |
| 97 | 97 | case 'br': |
| 98 | 98 | $text .= "\n"; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public const GOOGLE_PLAY_URL = 'https://play.google.com'; |
| 62 | 62 | |
| 63 | 63 | /** @var string Google Play apps url */ |
| 64 | - public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL . '/store/apps'; |
|
| 64 | + public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL.'/store/apps'; |
|
| 65 | 65 | |
| 66 | 66 | /** @var int Maximum number of search results (Google limit). */ |
| 67 | 67 | public const MAX_SEARCH_RESULTS = 250; |
@@ -326,12 +326,12 @@ discard block |
||
| 326 | 326 | /** |
| 327 | 327 | * @var AppDetail[] $list |
| 328 | 328 | */ |
| 329 | - $list = array_filter($list, static function (AppDetail $app) { |
|
| 329 | + $list = array_filter($list, static function(AppDetail $app) { |
|
| 330 | 330 | return !$app->isAutoTranslatedDescription(); |
| 331 | 331 | }); |
| 332 | 332 | |
| 333 | 333 | $preferredApp = $list[$preferredLocale]; |
| 334 | - $list = array_filter($list, static function (AppDetail $app, string $locale) use ($preferredApp, $list) { |
|
| 334 | + $list = array_filter($list, static function(AppDetail $app, string $locale) use ($preferredApp, $list) { |
|
| 335 | 335 | // deletes locales in which there is no translation added, but automatic translation by Google Translate is used. |
| 336 | 336 | if ($preferredApp->getLocale() === $locale || !$preferredApp->equals($app)) { |
| 337 | 337 | if (($pos = strpos($locale, '_')) !== false) { |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | // sorting array keys; the first key is the preferred locale |
| 356 | 356 | uksort( |
| 357 | 357 | $list, |
| 358 | - static function ( |
|
| 358 | + static function( |
|
| 359 | 359 | /** @noinspection PhpUnusedParameterInspection */ |
| 360 | 360 | string $a, |
| 361 | 361 | string $b |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $appId = $this->castToAppId($appId); |
| 381 | 381 | |
| 382 | 382 | try { |
| 383 | - return (bool)$this->getHttpClient()->request( |
|
| 383 | + return (bool) $this->getHttpClient()->request( |
|
| 384 | 384 | 'HEAD', |
| 385 | 385 | $appId->getFullUrl(), |
| 386 | 386 | [ |
@@ -457,14 +457,12 @@ discard block |
||
| 457 | 457 | $allReviews = []; |
| 458 | 458 | |
| 459 | 459 | $cacheTtl = $sort === SortEnum::NEWEST() ? |
| 460 | - \DateInterval::createFromDateString('5 min') : |
|
| 461 | - \DateInterval::createFromDateString('1 hour'); |
|
| 460 | + \DateInterval::createFromDateString('5 min') : \DateInterval::createFromDateString('1 hour'); |
|
| 462 | 461 | |
| 463 | 462 | try { |
| 464 | 463 | do { |
| 465 | 464 | $count = $limit === self::UNLIMIT ? |
| 466 | - PlayStoreUiRequest::LIMIT_REVIEW_ON_PAGE : |
|
| 467 | - min(PlayStoreUiRequest::LIMIT_REVIEW_ON_PAGE, max($limit - $allCount, 1)); |
|
| 465 | + PlayStoreUiRequest::LIMIT_REVIEW_ON_PAGE : min(PlayStoreUiRequest::LIMIT_REVIEW_ON_PAGE, max($limit - $allCount, 1)); |
|
| 468 | 466 | |
| 469 | 467 | $request = PlayStoreUiRequest::getReviewsRequest($appId, $count, $sort, $token); |
| 470 | 468 | |
@@ -566,8 +564,7 @@ discard block |
||
| 566 | 564 | |
| 567 | 565 | while ($token !== null && ($limit === self::UNLIMIT || $allCount < $limit)) { |
| 568 | 566 | $count = $limit === self::UNLIMIT ? |
| 569 | - PlayStoreUiRequest::LIMIT_APPS_ON_PAGE : |
|
| 570 | - min(PlayStoreUiRequest::LIMIT_APPS_ON_PAGE, max($limit - $allCount, 1)); |
|
| 567 | + PlayStoreUiRequest::LIMIT_APPS_ON_PAGE : min(PlayStoreUiRequest::LIMIT_APPS_ON_PAGE, max($limit - $allCount, 1)); |
|
| 571 | 568 | |
| 572 | 569 | $request = PlayStoreUiRequest::getAppsRequest($locale, $country, $count, $token); |
| 573 | 570 | |
@@ -607,7 +604,7 @@ discard block |
||
| 607 | 604 | { |
| 608 | 605 | $appId = $this->castToAppId($appId); |
| 609 | 606 | |
| 610 | - $url = self::GOOGLE_PLAY_URL . '/store/xhr/getdoc?authuser=0'; |
|
| 607 | + $url = self::GOOGLE_PLAY_URL.'/store/xhr/getdoc?authuser=0'; |
|
| 611 | 608 | try { |
| 612 | 609 | return $this->getHttpClient()->request( |
| 613 | 610 | 'POST', |
@@ -674,7 +671,7 @@ discard block |
||
| 674 | 671 | $urls = []; |
| 675 | 672 | $url = self::GOOGLE_PLAY_APPS_URL; |
| 676 | 673 | foreach ($locales as $locale) { |
| 677 | - $urls[$locale] = $url . '?' . http_build_query([ |
|
| 674 | + $urls[$locale] = $url.'?'.http_build_query([ |
|
| 678 | 675 | self::REQ_PARAM_LOCALE => $locale, |
| 679 | 676 | ]); |
| 680 | 677 | } |
@@ -730,7 +727,7 @@ discard block |
||
| 730 | 727 | )); |
| 731 | 728 | } |
| 732 | 729 | |
| 733 | - $url = self::GOOGLE_PLAY_APPS_URL . '/dev'; |
|
| 730 | + $url = self::GOOGLE_PLAY_APPS_URL.'/dev'; |
|
| 734 | 731 | try { |
| 735 | 732 | return $this->getHttpClient()->request( |
| 736 | 733 | 'GET', |
@@ -761,7 +758,7 @@ discard block |
||
| 761 | 758 | return $developerId->getId(); |
| 762 | 759 | } |
| 763 | 760 | if (is_int($developerId)) { |
| 764 | - return (string)$developerId; |
|
| 761 | + return (string) $developerId; |
|
| 765 | 762 | } |
| 766 | 763 | return $developerId; |
| 767 | 764 | } |
@@ -799,9 +796,9 @@ discard block |
||
| 799 | 796 | } |
| 800 | 797 | |
| 801 | 798 | $urls = []; |
| 802 | - $url = self::GOOGLE_PLAY_APPS_URL . '/dev'; |
|
| 799 | + $url = self::GOOGLE_PLAY_APPS_URL.'/dev'; |
|
| 803 | 800 | foreach ($locales as $locale) { |
| 804 | - $urls[$locale] = $url . '?' . http_build_query([ |
|
| 801 | + $urls[$locale] = $url.'?'.http_build_query([ |
|
| 805 | 802 | self::REQ_PARAM_ID => $id, |
| 806 | 803 | self::REQ_PARAM_LOCALE => $locale, |
| 807 | 804 | ]); |
@@ -843,7 +840,7 @@ discard block |
||
| 843 | 840 | ]; |
| 844 | 841 | |
| 845 | 842 | if (is_numeric($developerId)) { |
| 846 | - $developerUrl = self::GOOGLE_PLAY_APPS_URL . '/dev?' . http_build_query($query); |
|
| 843 | + $developerUrl = self::GOOGLE_PLAY_APPS_URL.'/dev?'.http_build_query($query); |
|
| 847 | 844 | try { |
| 848 | 845 | /** |
| 849 | 846 | * @var string|null $developerUrl |
@@ -858,13 +855,13 @@ discard block |
||
| 858 | 855 | if ($developerUrl === null) { |
| 859 | 856 | return []; |
| 860 | 857 | } |
| 861 | - $developerUrl .= '&' . self::REQ_PARAM_LOCALE . '=' . urlencode($this->locale) . |
|
| 862 | - '&' . self::REQ_PARAM_COUNTRY . '=' . urlencode($this->country); |
|
| 858 | + $developerUrl .= '&'.self::REQ_PARAM_LOCALE.'='.urlencode($this->locale). |
|
| 859 | + '&'.self::REQ_PARAM_COUNTRY.'='.urlencode($this->country); |
|
| 863 | 860 | } catch (GuzzleException $e) { |
| 864 | 861 | throw new GooglePlayException($e->getMessage(), $e->getCode(), $e); |
| 865 | 862 | } |
| 866 | 863 | } else { |
| 867 | - $developerUrl = self::GOOGLE_PLAY_APPS_URL . '/developer?' . http_build_query($query); |
|
| 864 | + $developerUrl = self::GOOGLE_PLAY_APPS_URL.'/developer?'.http_build_query($query); |
|
| 868 | 865 | } |
| 869 | 866 | |
| 870 | 867 | return $this->getAppsFromClusterPage( |
@@ -945,7 +942,7 @@ discard block |
||
| 945 | 942 | 'gl' => $this->country, |
| 946 | 943 | 'price' => $price->value(), |
| 947 | 944 | ]; |
| 948 | - $clusterPageUrl = self::GOOGLE_PLAY_URL . '/store/search?' . http_build_query($params); |
|
| 945 | + $clusterPageUrl = self::GOOGLE_PLAY_URL.'/store/search?'.http_build_query($params); |
|
| 949 | 946 | |
| 950 | 947 | return $this->getAppsFromClusterPage($clusterPageUrl, $this->locale, $this->country, $limit); |
| 951 | 948 | } |
@@ -981,13 +978,13 @@ discard block |
||
| 981 | 978 | $maxResults = $maxOffset + $limitOnPage; |
| 982 | 979 | |
| 983 | 980 | $limit = $limit === self::UNLIMIT ? $maxResults : min($maxResults, max(1, $limit)); |
| 984 | - $collection = (string)$collection; |
|
| 981 | + $collection = (string) $collection; |
|
| 985 | 982 | |
| 986 | - $url = self::GOOGLE_PLAY_APPS_URL . ''; |
|
| 983 | + $url = self::GOOGLE_PLAY_APPS_URL.''; |
|
| 987 | 984 | if ($category !== null) { |
| 988 | - $url .= '/category/' . $this->castToCategoryId($category); |
|
| 985 | + $url .= '/category/'.$this->castToCategoryId($category); |
|
| 989 | 986 | } |
| 990 | - $url .= '/collection/' . $collection; |
|
| 987 | + $url .= '/collection/'.$collection; |
|
| 991 | 988 | |
| 992 | 989 | $offset = 0; |
| 993 | 990 | |
@@ -1049,7 +1046,7 @@ discard block |
||
| 1049 | 1046 | if ($category instanceof Category) { |
| 1050 | 1047 | return $category->getId(); |
| 1051 | 1048 | } |
| 1052 | - return (string)$category; |
|
| 1049 | + return (string) $category; |
|
| 1053 | 1050 | } |
| 1054 | 1051 | |
| 1055 | 1052 | /** |
@@ -1076,14 +1073,14 @@ discard block |
||
| 1076 | 1073 | $mapping = []; |
| 1077 | 1074 | foreach ($images as $image) { |
| 1078 | 1075 | if (!$image instanceof GoogleImage) { |
| 1079 | - throw new \InvalidArgumentException('An array of ' . GoogleImage::class . ' objects is expected.'); |
|
| 1076 | + throw new \InvalidArgumentException('An array of '.GoogleImage::class.' objects is expected.'); |
|
| 1080 | 1077 | } |
| 1081 | 1078 | $destPath = $destPathCallback($image); |
| 1082 | 1079 | $mapping[$destPath] = $image->getUrl(); |
| 1083 | 1080 | } |
| 1084 | 1081 | |
| 1085 | 1082 | $httpClient = $this->getHttpClient(); |
| 1086 | - $promises = (static function () use ($mapping, $overwrite, $httpClient) { |
|
| 1083 | + $promises = (static function() use ($mapping, $overwrite, $httpClient) { |
|
| 1087 | 1084 | foreach ($mapping as $destPath => $url) { |
| 1088 | 1085 | if (!$overwrite && is_file($destPath)) { |
| 1089 | 1086 | yield $destPath => new FulfilledPromise($url); |
@@ -1098,7 +1095,7 @@ discard block |
||
| 1098 | 1095 | RequestOptions::SINK => $destPath, |
| 1099 | 1096 | RequestOptions::HTTP_ERRORS => true, |
| 1100 | 1097 | ]) |
| 1101 | - ->then(static function ( |
|
| 1098 | + ->then(static function( |
|
| 1102 | 1099 | /** @noinspection PhpUnusedParameterInspection */ |
| 1103 | 1100 | ResponseInterface $response |
| 1104 | 1101 | ) use ($url) { |
@@ -1114,10 +1111,10 @@ discard block |
||
| 1114 | 1111 | $imageInfoList = []; |
| 1115 | 1112 | (new EachPromise($promises, [ |
| 1116 | 1113 | 'concurrency' => $this->concurrency, |
| 1117 | - 'fulfilled' => static function (string $url, string $destPath) use (&$imageInfoList) { |
|
| 1114 | + 'fulfilled' => static function(string $url, string $destPath) use (&$imageInfoList) { |
|
| 1118 | 1115 | $imageInfoList[] = new ImageInfo($url, $destPath); |
| 1119 | 1116 | }, |
| 1120 | - 'rejected' => static function (\Throwable $reason, string $key) use ($mapping) { |
|
| 1117 | + 'rejected' => static function(\Throwable $reason, string $key) use ($mapping) { |
|
| 1121 | 1118 | $exceptionUrl = $mapping[$key]; |
| 1122 | 1119 | foreach ($mapping as $destPath => $url) { |
| 1123 | 1120 | if (is_file($destPath)) { |
@@ -46,9 +46,9 @@ |
||
| 46 | 46 | $scriptData = ScraperUtil::extractScriptData($response->getBody()->getContents()); |
| 47 | 47 | foreach ($scriptData as $key => $scriptValue) { |
| 48 | 48 | if (isset($scriptValue[1][1][0][0][3][4][2])) { |
| 49 | - return GPlayApps::GOOGLE_PLAY_URL . $scriptValue[1][1][0][0][3][4][2] . |
|
| 50 | - '&' . GPlayApps::REQ_PARAM_LOCALE . '=' . urlencode($this->appId->getLocale()) . |
|
| 51 | - '&' . GPlayApps::REQ_PARAM_COUNTRY . '=' . urlencode($this->appId->getCountry()); |
|
| 49 | + return GPlayApps::GOOGLE_PLAY_URL.$scriptValue[1][1][0][0][3][4][2]. |
|
| 50 | + '&'.GPlayApps::REQ_PARAM_LOCALE.'='.urlencode($this->appId->getLocale()). |
|
| 51 | + '&'.GPlayApps::REQ_PARAM_COUNTRY.'='.urlencode($this->appId->getCountry()); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | return null; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $summary = $this->extractSummary($scriptDataInfo); |
| 130 | 130 | $installs = $scriptDataInfo[0][12][9][2] ?? 0; |
| 131 | 131 | $offersIAPCost = $scriptDataInfo[0][12][12][0] ?? null; |
| 132 | - $containsAds = (bool)$scriptDataInfo[0][12][14][0]; |
|
| 132 | + $containsAds = (bool) $scriptDataInfo[0][12][14][0]; |
|
| 133 | 133 | $editorsChoice = !empty($scriptDataInfo[0][12][15][1][1]); |
| 134 | 134 | $privacyPoliceUrl = $scriptDataInfo[0][12][7][2] ?? ''; |
| 135 | 135 | $categoryFamily = $this->extractCategory($scriptDataInfo[0][12][13][1] ?? []); |
@@ -193,8 +193,7 @@ discard block |
||
| 193 | 193 | LocaleHelper::findPreferredLanguage( |
| 194 | 194 | $locale, |
| 195 | 195 | $scriptDataInfo[0][19][1] |
| 196 | - ) : |
|
| 197 | - null; |
|
| 196 | + ) : null; |
|
| 198 | 197 | } |
| 199 | 198 | |
| 200 | 199 | /** |
@@ -203,7 +202,7 @@ discard block |
||
| 203 | 202 | */ |
| 204 | 203 | private function extractDeveloper(array $scriptDataInfo): Developer |
| 205 | 204 | { |
| 206 | - $developerPage = GPlayApps::GOOGLE_PLAY_URL . $scriptDataInfo[0][12][5][5][4][2]; |
|
| 205 | + $developerPage = GPlayApps::GOOGLE_PLAY_URL.$scriptDataInfo[0][12][5][5][4][2]; |
|
| 207 | 206 | $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))[GPlayApps::REQ_PARAM_ID]; |
| 208 | 207 | $developerName = $scriptDataInfo[0][12][5][1]; |
| 209 | 208 | $developerEmail = $scriptDataInfo[0][12][5][2][0]; |
@@ -229,8 +228,8 @@ discard block |
||
| 229 | 228 | private function extractCategory(array $data): ?Category |
| 230 | 229 | { |
| 231 | 230 | if (isset($data[0]) && $data[0] !== null && $data[2] !== null) { |
| 232 | - $genreId = (string)$data[2]; |
|
| 233 | - $genreName = (string)$data[0]; |
|
| 231 | + $genreId = (string) $data[2]; |
|
| 232 | + $genreName = (string) $data[0]; |
|
| 234 | 233 | return new Category($genreId, $genreName); |
| 235 | 234 | } |
| 236 | 235 | return null; |
@@ -275,7 +274,7 @@ discard block |
||
| 275 | 274 | */ |
| 276 | 275 | private function extractScreenshots(array $scriptDataInfo): array |
| 277 | 276 | { |
| 278 | - return !empty($scriptDataInfo[0][12][0]) ? array_map(static function (array $v) { |
|
| 277 | + return !empty($scriptDataInfo[0][12][0]) ? array_map(static function(array $v) { |
|
| 279 | 278 | return new GoogleImage($v[3][2]); |
| 280 | 279 | }, $scriptDataInfo[0][12][0]) : []; |
| 281 | 280 | } |
@@ -291,8 +290,8 @@ discard block |
||
| 291 | 290 | $scriptDataInfo[0][12][3][0][3][2] !== null && |
| 292 | 291 | $scriptDataInfo[0][12][3][1][3][2] !== null |
| 293 | 292 | ) { |
| 294 | - $videoThumb = (string)$scriptDataInfo[0][12][3][1][3][2]; |
|
| 295 | - $videoUrl = (string)$scriptDataInfo[0][12][3][0][3][2]; |
|
| 293 | + $videoThumb = (string) $scriptDataInfo[0][12][3][1][3][2]; |
|
| 294 | + $videoUrl = (string) $scriptDataInfo[0][12][3][0][3][2]; |
|
| 296 | 295 | |
| 297 | 296 | return new Video($videoThumb, $videoUrl); |
| 298 | 297 | } |
@@ -341,9 +340,9 @@ discard block |
||
| 341 | 340 | */ |
| 342 | 341 | private function handlerDataRating(AppBuilder $appBuilder, array $scriptDataRating): void |
| 343 | 342 | { |
| 344 | - $score = (float)($scriptDataRating[0][6][0][1] ?? 0); |
|
| 345 | - $numberVoters = (int)($scriptDataRating[0][6][2][1] ?? 0); |
|
| 346 | - $numberReviews = (int)($scriptDataRating[0][6][3][1] ?? 0); |
|
| 343 | + $score = (float) ($scriptDataRating[0][6][0][1] ?? 0); |
|
| 344 | + $numberVoters = (int) ($scriptDataRating[0][6][2][1] ?? 0); |
|
| 345 | + $numberReviews = (int) ($scriptDataRating[0][6][3][1] ?? 0); |
|
| 347 | 346 | $histogramRating = $this->extractHistogramRating($scriptDataRating); |
| 348 | 347 | |
| 349 | 348 | $appBuilder |
@@ -392,8 +391,7 @@ discard block |
||
| 392 | 391 | private function extractPrice(array $scriptDataPrice): ?float |
| 393 | 392 | { |
| 394 | 393 | return isset($scriptDataPrice[0][2][0][0][0][1][0][0]) ? |
| 395 | - (float)($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : |
|
| 396 | - 0.0; |
|
| 394 | + (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : 0.0; |
|
| 397 | 395 | } |
| 398 | 396 | |
| 399 | 397 | /** |
@@ -33,8 +33,8 @@ |
||
| 33 | 33 | { |
| 34 | 34 | $dataCategories = $this->getDataScraper($request, $response); |
| 35 | 35 | |
| 36 | - $parseCategories = static function (array $items) use (&$parseCategories) : array { |
|
| 37 | - return array_reduce($items, static function ($results, $item) use (&$parseCategories) { |
|
| 36 | + $parseCategories = static function(array $items) use (&$parseCategories) : array { |
|
| 37 | + return array_reduce($items, static function($results, $item) use (&$parseCategories) { |
|
| 38 | 38 | if (is_array($item)) { |
| 39 | 39 | if ( |
| 40 | 40 | count($item) === 6 && |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $query = parse_query($request->getUri()->getQuery()); |
| 36 | 36 | |
| 37 | 37 | $developerId = $query[GPlayApps::REQ_PARAM_ID]; |
| 38 | - $url = (string)$request->getUri() |
|
| 38 | + $url = (string) $request->getUri() |
|
| 39 | 39 | ->withQuery(http_build_query([GPlayApps::REQ_PARAM_ID => $developerId])); |
| 40 | 40 | |
| 41 | 41 | $scriptDataInfo = $this->getScriptDataInfo($request, $response); |