@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public const GOOGLE_PLAY_URL = 'https://play.google.com'; |
39 | 39 | |
40 | 40 | /** @var string Google Play apps url. */ |
41 | - public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL . '/store/apps'; |
|
41 | + public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL.'/store/apps'; |
|
42 | 42 | |
43 | 43 | /** @var int Unlimit results. */ |
44 | 44 | public const UNLIMIT = -1; |
@@ -313,18 +313,18 @@ discard block |
||
313 | 313 | */ |
314 | 314 | $list = array_filter( |
315 | 315 | $list, |
316 | - static function (Model\AppInfo $app) { |
|
316 | + static function(Model\AppInfo $app) { |
|
317 | 317 | return !$app->isAutoTranslatedDescription(); |
318 | 318 | } |
319 | 319 | ); |
320 | 320 | |
321 | 321 | if (!isset($list[$preferredLocale])) { |
322 | - throw new \RuntimeException('No key ' . $preferredLocale); |
|
322 | + throw new \RuntimeException('No key '.$preferredLocale); |
|
323 | 323 | } |
324 | 324 | $preferredApp = $list[$preferredLocale]; |
325 | 325 | $list = array_filter( |
326 | 326 | $list, |
327 | - static function (Model\AppInfo $app, string $locale) use ($preferredApp, $list) { |
|
327 | + static function(Model\AppInfo $app, string $locale) use ($preferredApp, $list) { |
|
328 | 328 | // deletes locales in which there is no translation added, but automatic translation by Google Translate is used. |
329 | 329 | if ($preferredApp->getLocale() === $locale || !$preferredApp->equals($app)) { |
330 | 330 | if (($pos = strpos($locale, '_')) !== false) { |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | // sorting array keys; the first key is the preferred locale |
354 | 354 | uksort( |
355 | 355 | $list, |
356 | - static function ( |
|
356 | + static function( |
|
357 | 357 | /** @noinspection PhpUnusedParameterInspection */ |
358 | 358 | string $a, |
359 | 359 | string $b |
@@ -463,14 +463,12 @@ discard block |
||
463 | 463 | $allReviews = []; |
464 | 464 | |
465 | 465 | $cacheTtl = $sort === Enum\SortEnum::NEWEST() ? |
466 | - \DateInterval::createFromDateString('1 min') : |
|
467 | - \DateInterval::createFromDateString('1 hour'); |
|
466 | + \DateInterval::createFromDateString('1 min') : \DateInterval::createFromDateString('1 hour'); |
|
468 | 467 | |
469 | 468 | try { |
470 | 469 | do { |
471 | 470 | $count = $limit === self::UNLIMIT ? |
472 | - Scraper\PlayStoreUiRequest::LIMIT_REVIEW_ON_PAGE : |
|
473 | - min(Scraper\PlayStoreUiRequest::LIMIT_REVIEW_ON_PAGE, max($limit - $allCount, 1)); |
|
471 | + Scraper\PlayStoreUiRequest::LIMIT_REVIEW_ON_PAGE : min(Scraper\PlayStoreUiRequest::LIMIT_REVIEW_ON_PAGE, max($limit - $allCount, 1)); |
|
474 | 472 | |
475 | 473 | $request = Scraper\PlayStoreUiRequest::getReviewsRequest($appId, $count, $sort, $token); |
476 | 474 | |
@@ -510,7 +508,7 @@ discard block |
||
510 | 508 | /** @var Model\Review $review */ |
511 | 509 | $review = $this->getHttpClient()->request( |
512 | 510 | 'GET', |
513 | - self::GOOGLE_PLAY_APPS_URL . '/details', |
|
511 | + self::GOOGLE_PLAY_APPS_URL.'/details', |
|
514 | 512 | [ |
515 | 513 | RequestOptions::QUERY => [ |
516 | 514 | self::REQ_PARAM_ID => $appId->getId(), |
@@ -619,7 +617,7 @@ discard block |
||
619 | 617 | $url = self::GOOGLE_PLAY_APPS_URL; |
620 | 618 | |
621 | 619 | foreach ($locales as $locale) { |
622 | - $urls[$locale] = $url . '?' . http_build_query( |
|
620 | + $urls[$locale] = $url.'?'.http_build_query( |
|
623 | 621 | [ |
624 | 622 | self::REQ_PARAM_LOCALE => $locale, |
625 | 623 | ] |
@@ -684,7 +682,7 @@ discard block |
||
684 | 682 | ); |
685 | 683 | } |
686 | 684 | |
687 | - $url = self::GOOGLE_PLAY_APPS_URL . '/dev'; |
|
685 | + $url = self::GOOGLE_PLAY_APPS_URL.'/dev'; |
|
688 | 686 | |
689 | 687 | try { |
690 | 688 | /** @var Model\Developer $developer */ |
@@ -744,10 +742,10 @@ discard block |
||
744 | 742 | } |
745 | 743 | |
746 | 744 | $urls = []; |
747 | - $url = self::GOOGLE_PLAY_APPS_URL . '/dev'; |
|
745 | + $url = self::GOOGLE_PLAY_APPS_URL.'/dev'; |
|
748 | 746 | |
749 | 747 | foreach ($locales as $locale) { |
750 | - $urls[$locale] = $url . '?' . http_build_query( |
|
748 | + $urls[$locale] = $url.'?'.http_build_query( |
|
751 | 749 | [ |
752 | 750 | self::REQ_PARAM_ID => $id, |
753 | 751 | self::REQ_PARAM_LOCALE => $locale, |
@@ -793,7 +791,7 @@ discard block |
||
793 | 791 | ]; |
794 | 792 | |
795 | 793 | if (is_numeric($developerId)) { |
796 | - $developerUrl = self::GOOGLE_PLAY_APPS_URL . '/dev?' . http_build_query($query); |
|
794 | + $developerUrl = self::GOOGLE_PLAY_APPS_URL.'/dev?'.http_build_query($query); |
|
797 | 795 | |
798 | 796 | try { |
799 | 797 | /** |
@@ -810,13 +808,13 @@ discard block |
||
810 | 808 | if ($developerUrl === null) { |
811 | 809 | return []; |
812 | 810 | } |
813 | - $developerUrl .= '&' . self::REQ_PARAM_LOCALE . '=' . urlencode($this->defaultLocale) . |
|
814 | - '&' . self::REQ_PARAM_COUNTRY . '=' . urlencode($this->defaultCountry); |
|
811 | + $developerUrl .= '&'.self::REQ_PARAM_LOCALE.'='.urlencode($this->defaultLocale). |
|
812 | + '&'.self::REQ_PARAM_COUNTRY.'='.urlencode($this->defaultCountry); |
|
815 | 813 | } catch (\Throwable $e) { |
816 | 814 | throw new Exception\GooglePlayException($e->getMessage(), 1, $e); |
817 | 815 | } |
818 | 816 | } else { |
819 | - $developerUrl = self::GOOGLE_PLAY_APPS_URL . '/developer?' . http_build_query($query); |
|
817 | + $developerUrl = self::GOOGLE_PLAY_APPS_URL.'/developer?'.http_build_query($query); |
|
820 | 818 | } |
821 | 819 | |
822 | 820 | return $this->fetchAppsFromClusterPage( |
@@ -857,10 +855,10 @@ discard block |
||
857 | 855 | $query[self::REQ_PARAM_LOCALE] = $locale; |
858 | 856 | $query[self::REQ_PARAM_COUNTRY] = $country; |
859 | 857 | |
860 | - $clusterPageUrl = $clusterPageComponents['scheme'] . '://' . |
|
861 | - $clusterPageComponents['host'] . |
|
862 | - $clusterPageComponents['path'] . |
|
863 | - '?' . build_query($query); |
|
858 | + $clusterPageUrl = $clusterPageComponents['scheme'].'://'. |
|
859 | + $clusterPageComponents['host']. |
|
860 | + $clusterPageComponents['path']. |
|
861 | + '?'.build_query($query); |
|
864 | 862 | |
865 | 863 | try { |
866 | 864 | [$apps, $token] = $this->getHttpClient()->request( |
@@ -876,8 +874,7 @@ discard block |
||
876 | 874 | |
877 | 875 | while ($token !== null && ($limit === self::UNLIMIT || $allCount < $limit)) { |
878 | 876 | $count = $limit === self::UNLIMIT ? |
879 | - Scraper\PlayStoreUiRequest::LIMIT_APPS_ON_PAGE : |
|
880 | - min(Scraper\PlayStoreUiRequest::LIMIT_APPS_ON_PAGE, max($limit - $allCount, 1)); |
|
877 | + Scraper\PlayStoreUiRequest::LIMIT_APPS_ON_PAGE : min(Scraper\PlayStoreUiRequest::LIMIT_APPS_ON_PAGE, max($limit - $allCount, 1)); |
|
881 | 878 | |
882 | 879 | $request = Scraper\PlayStoreUiRequest::getAppsRequest($locale, $country, $count, $token); |
883 | 880 | |
@@ -1031,7 +1028,7 @@ discard block |
||
1031 | 1028 | self::REQ_PARAM_COUNTRY => $this->defaultCountry, |
1032 | 1029 | 'price' => $price->value(), |
1033 | 1030 | ]; |
1034 | - $clusterPageUrl = self::GOOGLE_PLAY_URL . '/store/search?' . http_build_query($params); |
|
1031 | + $clusterPageUrl = self::GOOGLE_PLAY_URL.'/store/search?'.http_build_query($params); |
|
1035 | 1032 | |
1036 | 1033 | return $this->fetchAppsFromClusterPage( |
1037 | 1034 | $clusterPageUrl, |
@@ -1136,13 +1133,13 @@ discard block |
||
1136 | 1133 | $url = self::GOOGLE_PLAY_APPS_URL; |
1137 | 1134 | |
1138 | 1135 | if ($path !== null) { |
1139 | - $url .= '/' . $path; |
|
1136 | + $url .= '/'.$path; |
|
1140 | 1137 | } |
1141 | 1138 | |
1142 | 1139 | if ($category !== null) { |
1143 | - $url .= '/category/' . Util\Caster::castToCategoryId($category); |
|
1140 | + $url .= '/category/'.Util\Caster::castToCategoryId($category); |
|
1144 | 1141 | } |
1145 | - $url .= '?' . http_build_query($queryParams); |
|
1142 | + $url .= '?'.http_build_query($queryParams); |
|
1146 | 1143 | |
1147 | 1144 | /** |
1148 | 1145 | * @var array $categoryClusterPages = [[ |
@@ -1234,7 +1231,7 @@ discard block |
||
1234 | 1231 | foreach ($images as $image) { |
1235 | 1232 | if (!$image instanceof Model\GoogleImage) { |
1236 | 1233 | throw new \InvalidArgumentException( |
1237 | - 'An array of ' . Model\GoogleImage::class . ' objects is expected.' |
|
1234 | + 'An array of '.Model\GoogleImage::class.' objects is expected.' |
|
1238 | 1235 | ); |
1239 | 1236 | } |
1240 | 1237 | $destPath = $destPathCallback($image); |
@@ -1243,7 +1240,7 @@ discard block |
||
1243 | 1240 | } |
1244 | 1241 | |
1245 | 1242 | $httpClient = $this->getHttpClient(); |
1246 | - $promises = (static function () use ($mapping, $overwrite, $httpClient) { |
|
1243 | + $promises = (static function() use ($mapping, $overwrite, $httpClient) { |
|
1247 | 1244 | foreach ($mapping as $url => $stream) { |
1248 | 1245 | $destPath = $stream->getFilename(); |
1249 | 1246 | $dynamicPath = strpos($destPath, '{url}') !== false; |
@@ -1259,7 +1256,7 @@ discard block |
||
1259 | 1256 | RequestOptions::COOKIES => null, |
1260 | 1257 | RequestOptions::SINK => $stream, |
1261 | 1258 | RequestOptions::HTTP_ERRORS => true, |
1262 | - RequestOptions::ON_HEADERS => static function (ResponseInterface $response) use ( |
|
1259 | + RequestOptions::ON_HEADERS => static function(ResponseInterface $response) use ( |
|
1263 | 1260 | $url, |
1264 | 1261 | $stream |
1265 | 1262 | ): void { |
@@ -1268,7 +1265,7 @@ discard block |
||
1268 | 1265 | ] |
1269 | 1266 | ) |
1270 | 1267 | ->then( |
1271 | - static function ( |
|
1268 | + static function( |
|
1272 | 1269 | /** @noinspection PhpUnusedParameterInspection */ |
1273 | 1270 | ResponseInterface $response |
1274 | 1271 | ) use ($url) { |
@@ -1288,10 +1285,10 @@ discard block |
||
1288 | 1285 | $promises, |
1289 | 1286 | [ |
1290 | 1287 | 'concurrency' => $this->concurrency, |
1291 | - 'fulfilled' => static function (string $url) use (&$imageInfoList, $mapping): void { |
|
1288 | + 'fulfilled' => static function(string $url) use (&$imageInfoList, $mapping): void { |
|
1292 | 1289 | $imageInfoList[] = new Model\ImageInfo($url, $mapping[$url]->getFilename()); |
1293 | 1290 | }, |
1294 | - 'rejected' => static function (\Throwable $reason, string $exceptionUrl) use ($mapping): void { |
|
1291 | + 'rejected' => static function(\Throwable $reason, string $exceptionUrl) use ($mapping): void { |
|
1295 | 1292 | foreach ($mapping as $destPath => $url) { |
1296 | 1293 | if (is_file($destPath)) { |
1297 | 1294 | unlink($destPath); |
@@ -1356,8 +1353,7 @@ discard block |
||
1356 | 1353 | public function setDefaultCountry(string $defaultCountry): self |
1357 | 1354 | { |
1358 | 1355 | $this->defaultCountry = !empty($defaultCountry) ? |
1359 | - $defaultCountry : |
|
1360 | - self::DEFAULT_COUNTRY; |
|
1356 | + $defaultCountry : self::DEFAULT_COUNTRY; |
|
1361 | 1357 | |
1362 | 1358 | return $this; |
1363 | 1359 | } |