@@ -55,10 +55,10 @@ |
||
| 55 | 55 | ; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $parseCategories = static function (array $items) use (&$parseCategories): array { |
|
| 58 | + $parseCategories = static function(array $items) use (&$parseCategories): array { |
|
| 59 | 59 | return array_reduce( |
| 60 | 60 | $items, |
| 61 | - static function ($results, $item) use (&$parseCategories) { |
|
| 61 | + static function($results, $item) use (&$parseCategories) { |
|
| 62 | 62 | if (\is_array($item)) { |
| 63 | 63 | if ( |
| 64 | 64 | \count($item) === 6 |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | if (isset($datePatternObj['months'])) { |
| 1222 | 1222 | if (!isset($datePatternObj['months'][$month])) { |
| 1223 | 1223 | throw new \RuntimeException( |
| 1224 | - 'Error convert date. Locale ' . $locale . '. Date: ' . $dateText |
|
| 1225 | - . '. Matches: ' . var_export($match, true) |
|
| 1224 | + 'Error convert date. Locale '.$locale.'. Date: '.$dateText |
|
| 1225 | + . '. Matches: '.var_export($match, true) |
|
| 1226 | 1226 | ); |
| 1227 | 1227 | } |
| 1228 | 1228 | $month = $datePatternObj['months'][$month]; |
@@ -1234,7 +1234,7 @@ discard block |
||
| 1234 | 1234 | |
| 1235 | 1235 | $dateTime = \DateTimeImmutable::createFromFormat( |
| 1236 | 1236 | 'Y.m.d H:i:s', |
| 1237 | - $year . '.' . $month . '.' . $day . ' 00:00:00', |
|
| 1237 | + $year.'.'.$month.'.'.$day.' 00:00:00', |
|
| 1238 | 1238 | new \DateTimeZone('UTC') |
| 1239 | 1239 | ); |
| 1240 | 1240 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | if (preg_match_all('/>AF_initDataCallback\((.*?)\);<\/script/s', $html, $matches)) { |
| 31 | 31 | $scripts = array_reduce( |
| 32 | 32 | $matches[0], |
| 33 | - static function ($carry, $item) { |
|
| 33 | + static function($carry, $item) { |
|
| 34 | 34 | if ( |
| 35 | 35 | preg_match("/(ds:.*?)'/", $item, $keyMatch) |
| 36 | 36 | && preg_match('/data:([\s\S]*?)(, }\);<\/|, sideChannel:)/', $item, $valueMatch) |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | $doc = new \DOMDocument(); |
| 58 | 58 | $internalErrors = libxml_use_internal_errors(true); |
| 59 | 59 | |
| 60 | - if (!$doc->loadHTML('<?xml encoding="utf-8"?>' . $html)) { |
|
| 60 | + if (!$doc->loadHTML('<?xml encoding="utf-8"?>'.$html)) { |
|
| 61 | 61 | throw new \RuntimeException( |
| 62 | - 'error load html: ' . $html |
|
| 62 | + 'error load html: '.$html |
|
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | libxml_use_internal_errors($internalErrors); |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | case 'p': |
| 110 | 110 | case 'ul': |
| 111 | 111 | case 'div': |
| 112 | - $text = "\n\n" . $text . "\n\n"; |
|
| 112 | + $text = "\n\n".$text."\n\n"; |
|
| 113 | 113 | break; |
| 114 | 114 | |
| 115 | 115 | case 'li': |
| 116 | - $text = '- ' . $text . "\n"; |
|
| 116 | + $text = '- '.$text."\n"; |
|
| 117 | 117 | break; |
| 118 | 118 | |
| 119 | 119 | case 'br': |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public const GOOGLE_PLAY_URL = 'https://play.google.com'; |
| 41 | 41 | |
| 42 | 42 | /** @var string Google Play apps url. */ |
| 43 | - public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL . '/store/apps'; |
|
| 43 | + public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL.'/store/apps'; |
|
| 44 | 44 | |
| 45 | 45 | /** @var int Unlimit results. */ |
| 46 | 46 | public const UNLIMIT = -1; |
@@ -287,18 +287,18 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | $list = array_filter( |
| 289 | 289 | $list, |
| 290 | - static function (Model\AppInfo $app) { |
|
| 290 | + static function(Model\AppInfo $app) { |
|
| 291 | 291 | return !$app->isAutoTranslatedDescription(); |
| 292 | 292 | } |
| 293 | 293 | ); |
| 294 | 294 | |
| 295 | 295 | if (!isset($list[$preferredLocale])) { |
| 296 | - throw new \RuntimeException('No key ' . $preferredLocale); |
|
| 296 | + throw new \RuntimeException('No key '.$preferredLocale); |
|
| 297 | 297 | } |
| 298 | 298 | $preferredApp = $list[$preferredLocale]; |
| 299 | 299 | $list = array_filter( |
| 300 | 300 | $list, |
| 301 | - static function (Model\AppInfo $app, string $locale) use ($preferredApp, $list) { |
|
| 301 | + static function(Model\AppInfo $app, string $locale) use ($preferredApp, $list) { |
|
| 302 | 302 | // deletes locales in which there is no translation added, but automatic translation by Google Translate is used. |
| 303 | 303 | if ($preferredApp->getLocale() === $locale || !$preferredApp->equals($app)) { |
| 304 | 304 | if (($pos = strpos($locale, '_')) !== false) { |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | // sorting array keys; the first key is the preferred locale |
| 328 | 328 | uksort( |
| 329 | 329 | $list, |
| 330 | - static function ( |
|
| 330 | + static function( |
|
| 331 | 331 | /** @noinspection PhpUnusedParameterInspection */ |
| 332 | 332 | string $a, |
| 333 | 333 | string $b |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | $parseHandler = new Scraper\ExistsAppScraper(); |
| 392 | - $requests = array_map(function ($appId) use ($parseHandler) { |
|
| 392 | + $requests = array_map(function($appId) use ($parseHandler) { |
|
| 393 | 393 | $fullUrl = Util\Caster::castToAppId($appId, $this->defaultLocale, $this->defaultCountry)->getFullUrl(); |
| 394 | 394 | $psrRequest = new PsrRequest('HEAD', $fullUrl, [], null, '2.0'); |
| 395 | 395 | |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | 'reviewId' => $reviewId, |
| 489 | 489 | ]); |
| 490 | 490 | |
| 491 | - $detailUrl = self::GOOGLE_PLAY_APPS_URL . '/details?' . $queryString; |
|
| 491 | + $detailUrl = self::GOOGLE_PLAY_APPS_URL.'/details?'.$queryString; |
|
| 492 | 492 | |
| 493 | 493 | $request = new Request( |
| 494 | 494 | new PsrRequest('GET', $detailUrl, [], null, '2.0'), |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | */ |
| 545 | 545 | public function getCategories(): array |
| 546 | 546 | { |
| 547 | - $url = self::GOOGLE_PLAY_APPS_URL . '?' . http_build_query( |
|
| 547 | + $url = self::GOOGLE_PLAY_APPS_URL.'?'.http_build_query( |
|
| 548 | 548 | [ |
| 549 | 549 | self::REQ_PARAM_LOCALE => $this->defaultLocale, |
| 550 | 550 | ] |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | $requests = []; |
| 591 | 591 | |
| 592 | 592 | foreach ($locales as $locale) { |
| 593 | - $requestUrl = $url . '?' . http_build_query([self::REQ_PARAM_LOCALE => $locale]); |
|
| 593 | + $requestUrl = $url.'?'.http_build_query([self::REQ_PARAM_LOCALE => $locale]); |
|
| 594 | 594 | $requests[$locale] = new Request( |
| 595 | 595 | new PsrRequest('GET', $requestUrl, [], null, '2.0'), |
| 596 | 596 | [], |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | ); |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - $url = self::GOOGLE_PLAY_APPS_URL . '/dev?' . http_build_query([ |
|
| 652 | + $url = self::GOOGLE_PLAY_APPS_URL.'/dev?'.http_build_query([ |
|
| 653 | 653 | self::REQ_PARAM_ID => $developerId, |
| 654 | 654 | self::REQ_PARAM_LOCALE => $this->defaultLocale, |
| 655 | 655 | ]); |
@@ -705,11 +705,11 @@ discard block |
||
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | $requests = []; |
| 708 | - $url = self::GOOGLE_PLAY_APPS_URL . '/dev'; |
|
| 708 | + $url = self::GOOGLE_PLAY_APPS_URL.'/dev'; |
|
| 709 | 709 | $parseHandler = new Scraper\DeveloperInfoScraper(); |
| 710 | 710 | |
| 711 | 711 | foreach ($locales as $locale) { |
| 712 | - $requestUrl = $url . '?' . http_build_query( |
|
| 712 | + $requestUrl = $url.'?'.http_build_query( |
|
| 713 | 713 | [ |
| 714 | 714 | self::REQ_PARAM_ID => $id, |
| 715 | 715 | self::REQ_PARAM_LOCALE => $locale, |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | ]; |
| 754 | 754 | |
| 755 | 755 | if (is_numeric($developerId)) { |
| 756 | - $developerUrl = self::GOOGLE_PLAY_APPS_URL . '/dev?' . http_build_query($query); |
|
| 756 | + $developerUrl = self::GOOGLE_PLAY_APPS_URL.'/dev?'.http_build_query($query); |
|
| 757 | 757 | |
| 758 | 758 | try { |
| 759 | 759 | /** |
@@ -771,13 +771,13 @@ discard block |
||
| 771 | 771 | return []; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | - $developerUrl .= '&' . self::REQ_PARAM_LOCALE . '=' . urlencode($this->defaultLocale) |
|
| 775 | - . '&' . self::REQ_PARAM_COUNTRY . '=' . urlencode($this->defaultCountry); |
|
| 774 | + $developerUrl .= '&'.self::REQ_PARAM_LOCALE.'='.urlencode($this->defaultLocale) |
|
| 775 | + . '&'.self::REQ_PARAM_COUNTRY.'='.urlencode($this->defaultCountry); |
|
| 776 | 776 | } catch (\Throwable $e) { |
| 777 | 777 | throw new Exception\GooglePlayException($e->getMessage(), 1, $e); |
| 778 | 778 | } |
| 779 | 779 | } else { |
| 780 | - $developerUrl = self::GOOGLE_PLAY_APPS_URL . '/developer?' . http_build_query($query); |
|
| 780 | + $developerUrl = self::GOOGLE_PLAY_APPS_URL.'/developer?'.http_build_query($query); |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | return $this->fetchAppsFromClusterPage( |
@@ -946,13 +946,13 @@ discard block |
||
| 946 | 946 | $url = self::GOOGLE_PLAY_APPS_URL; |
| 947 | 947 | |
| 948 | 948 | if ($path !== null) { |
| 949 | - $url .= '/' . $path; |
|
| 949 | + $url .= '/'.$path; |
|
| 950 | 950 | } |
| 951 | 951 | |
| 952 | 952 | if ($category !== null) { |
| 953 | - $url .= '/category/' . Util\Caster::castToCategoryId($category); |
|
| 953 | + $url .= '/category/'.Util\Caster::castToCategoryId($category); |
|
| 954 | 954 | } |
| 955 | - $url .= '?' . http_build_query($queryParams); |
|
| 955 | + $url .= '?'.http_build_query($queryParams); |
|
| 956 | 956 | |
| 957 | 957 | ['results' => $results, 'token' => $token] = $this->getHttpClient()->request( |
| 958 | 958 | new Request( |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | self::REQ_PARAM_COUNTRY => $this->defaultCountry, |
| 1065 | 1065 | 'price' => $price->value(), |
| 1066 | 1066 | ]; |
| 1067 | - $clusterPageUrl = self::GOOGLE_PLAY_URL . '/store/search?' . http_build_query($params); |
|
| 1067 | + $clusterPageUrl = self::GOOGLE_PLAY_URL.'/store/search?'.http_build_query($params); |
|
| 1068 | 1068 | |
| 1069 | 1069 | return $this->fetchAppsFromClusterPage( |
| 1070 | 1070 | $clusterPageUrl, |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | foreach ($images as $image) { |
| 1219 | 1219 | if (!$image instanceof Model\GoogleImage) { |
| 1220 | 1220 | throw new \InvalidArgumentException( |
| 1221 | - 'An array of ' . Model\GoogleImage::class . ' objects is expected.' |
|
| 1221 | + 'An array of '.Model\GoogleImage::class.' objects is expected.' |
|
| 1222 | 1222 | ); |
| 1223 | 1223 | } |
| 1224 | 1224 | $destPath = $destPathCallback($image); |
@@ -1227,7 +1227,7 @@ discard block |
||
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | $httpClient = $this->getHttpClient(); |
| 1230 | - $promises = (static function () use ($mapping, $overwrite, $httpClient) { |
|
| 1230 | + $promises = (static function() use ($mapping, $overwrite, $httpClient) { |
|
| 1231 | 1231 | foreach ($mapping as $url => $stream) { |
| 1232 | 1232 | $destPath = $stream->getFilename(); |
| 1233 | 1233 | $dynamicPath = strpos($destPath, '{url}') !== false; |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | RequestOptions::COOKIES => null, |
| 1244 | 1244 | RequestOptions::SINK => $stream, |
| 1245 | 1245 | RequestOptions::HTTP_ERRORS => true, |
| 1246 | - RequestOptions::ON_HEADERS => static function (ResponseInterface $response) use ( |
|
| 1246 | + RequestOptions::ON_HEADERS => static function(ResponseInterface $response) use ( |
|
| 1247 | 1247 | $url, |
| 1248 | 1248 | $stream |
| 1249 | 1249 | ): void { |
@@ -1252,7 +1252,7 @@ discard block |
||
| 1252 | 1252 | ] |
| 1253 | 1253 | ) |
| 1254 | 1254 | ->then( |
| 1255 | - static function ( |
|
| 1255 | + static function( |
|
| 1256 | 1256 | /** @noinspection PhpUnusedParameterInspection */ |
| 1257 | 1257 | ResponseInterface $response |
| 1258 | 1258 | ) use ($url) { |
@@ -1272,10 +1272,10 @@ discard block |
||
| 1272 | 1272 | $promises, |
| 1273 | 1273 | [ |
| 1274 | 1274 | 'concurrency' => $this->getHttpClient()->getConcurrency(), |
| 1275 | - 'fulfilled' => static function (string $url) use (&$imageInfoList, $mapping): void { |
|
| 1275 | + 'fulfilled' => static function(string $url) use (&$imageInfoList, $mapping): void { |
|
| 1276 | 1276 | $imageInfoList[] = new Model\ImageInfo($url, $mapping[$url]->getFilename()); |
| 1277 | 1277 | }, |
| 1278 | - 'rejected' => static function (\Throwable $reason, string $exceptionUrl) use ($mapping): void { |
|
| 1278 | + 'rejected' => static function(\Throwable $reason, string $exceptionUrl) use ($mapping): void { |
|
| 1279 | 1279 | foreach ($mapping as $destPath => $url) { |
| 1280 | 1280 | if (is_file($destPath)) { |
| 1281 | 1281 | unlink($destPath); |