Passed
Branch feature/fix-old-client (fdd7f0)
by Alexey
05:33
created
src/GPlayApps.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
395 395
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
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),
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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),
596 596
                 [],
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.