Passed
Branch develop (610403)
by Alexey
02:26
created
src/GPlayApps.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     public const DEFAULT_COUNTRY = 'us'; // Affected price
58 58
 
59 59
     public const GOOGLE_PLAY_URL = 'https://play.google.com';
60
-    public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL . '/store/apps';
60
+    public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL.'/store/apps';
61 61
     public const MAX_SEARCH_RESULTS = 250;
62 62
 
63 63
     public const REQ_PARAM_LOCALE = 'hl';
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $urls = [];
236 236
         foreach ($requestApps as $key => $requestApp) {
237 237
             $requestApp = $this->castToRequestApp($requestApp);
238
-            $urls[$key] = self::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query([
238
+            $urls[$key] = self::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query([
239 239
                     self::REQ_PARAM_APP_ID => $requestApp->getId(),
240 240
                     self::REQ_PARAM_LOCALE => $requestApp->getLocale(),
241 241
                     self::REQ_PARAM_COUNTRY => $requestApp->getCountry(),
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         }
309 309
 
310 310
         $preferredApp = $list[$preferredLocale];
311
-        $list = array_filter($list, static function (AppDetail $app, string $locale) use ($preferredApp, $list) {
311
+        $list = array_filter($list, static function(AppDetail $app, string $locale) use ($preferredApp, $list) {
312 312
             // deletes locales in which there is no translation added, but automatic translation by Google Translate is used.
313 313
             if ($preferredApp->getLocale() === $locale || !$preferredApp->equals($app)) {
314 314
                 if (($pos = strpos($locale, '_')) !== false) {
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         // sorting array keys; the first key is the preferred locale
333 333
         uksort(
334 334
             $list,
335
-            static function (
335
+            static function(
336 336
                 /** @noinspection PhpUnusedParameterInspection */
337 337
                 string $a,
338 338
                 string $b
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
     public function existsApp($requestApp): bool
355 355
     {
356 356
         $requestApp = $this->castToRequestApp($requestApp);
357
-        $url = self::GOOGLE_PLAY_APPS_URL . '/details';
357
+        $url = self::GOOGLE_PLAY_APPS_URL.'/details';
358 358
 
359 359
         try {
360
-            return (bool)$this->getHttpClient()->request('HEAD', $url, [
360
+            return (bool) $this->getHttpClient()->request('HEAD', $url, [
361 361
                 RequestOptions::QUERY => [
362 362
                     self::REQ_PARAM_APP_ID => $requestApp->getId(),
363 363
                     self::REQ_PARAM_LOCALE => $requestApp->getLocale(),
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         $sort = $sort ?? SortEnum::NEWEST();
427 427
         $page = max(0, $page);
428 428
 
429
-        $url = self::GOOGLE_PLAY_URL . '/store/getreviews';
429
+        $url = self::GOOGLE_PLAY_URL.'/store/getreviews';
430 430
         $formParams = [
431 431
             self::REQ_PARAM_APP_ID => $requestApp->getId(),
432 432
             self::REQ_PARAM_LOCALE => $requestApp->getLocale(),
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
             self::REQ_PARAM_LOCALE => $requestApp->getLocale(),
519 519
             self::REQ_PARAM_COUNTRY => $requestApp->getCountry(),
520 520
         ];
521
-        $url = self::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query($params);
521
+        $url = self::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query($params);
522 522
         $httpClient = $this->getHttpClient();
523 523
         try {
524 524
             return $httpClient->request(
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     {
551 551
         $requestApp = $this->castToRequestApp($requestApp);
552 552
 
553
-        $url = self::GOOGLE_PLAY_URL . '/store/xhr/getdoc?authuser=0';
553
+        $url = self::GOOGLE_PLAY_URL.'/store/xhr/getdoc?authuser=0';
554 554
         try {
555 555
             return $this->getHttpClient()->request(
556 556
                 'POST',
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         $urls = [];
617 617
         $url = self::GOOGLE_PLAY_APPS_URL;
618 618
         foreach ($locales as $locale) {
619
-            $urls[$locale] = $url . '?' . http_build_query([
619
+            $urls[$locale] = $url.'?'.http_build_query([
620 620
                     self::REQ_PARAM_LOCALE => $locale,
621 621
                 ]);
622 622
         }
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
         }
664 664
 
665 665
         $locale = LocaleHelper::getNormalizeLocale($locale ?? $this->defaultLocale);
666
-        $url = self::GOOGLE_PLAY_APPS_URL . '/dev';
666
+        $url = self::GOOGLE_PLAY_APPS_URL.'/dev';
667 667
         try {
668 668
             return $this->getHttpClient()->request(
669 669
                 'GET',
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
             return $developerId->getId();
695 695
         }
696 696
         if (is_int($developerId)) {
697
-            return (string)$developerId;
697
+            return (string) $developerId;
698 698
         }
699 699
         return $developerId;
700 700
     }
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
         }
722 722
 
723 723
         $urls = [];
724
-        $url = self::GOOGLE_PLAY_APPS_URL . '/dev';
724
+        $url = self::GOOGLE_PLAY_APPS_URL.'/dev';
725 725
         foreach ($locales as $locale) {
726
-            $urls[$locale] = $url . '?' . http_build_query([
726
+            $urls[$locale] = $url.'?'.http_build_query([
727 727
                     self::REQ_PARAM_APP_ID => $id,
728 728
                     self::REQ_PARAM_LOCALE => $locale,
729 729
                 ]);
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         $preferredLocale = self::DEFAULT_LOCALE;
759 759
 
760 760
         $preferredInfo = $list[$preferredLocale];
761
-        $list = array_filter($list, static function (Developer $info, string $locale) use ($preferredInfo, $preferredLocale) {
761
+        $list = array_filter($list, static function(Developer $info, string $locale) use ($preferredInfo, $preferredLocale) {
762 762
             return $locale === $preferredLocale || $preferredInfo->equals($info);
763 763
         }, ARRAY_FILTER_USE_BOTH);
764 764
 
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
         try {
811 811
             if (is_numeric($developerId)) {
812
-                $url = self::GOOGLE_PLAY_APPS_URL . '/dev';
812
+                $url = self::GOOGLE_PLAY_APPS_URL.'/dev';
813 813
                 return $httpClient->request(
814 814
                     'GET',
815 815
                     $url,
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
                 );
826 826
             }
827 827
 
828
-            $url = self::GOOGLE_PLAY_APPS_URL . '/developer';
828
+            $url = self::GOOGLE_PLAY_APPS_URL.'/developer';
829 829
             return $httpClient->request(
830 830
                 'GET',
831 831
                 $url,
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
                         public function __invoke(RequestInterface $request, ResponseInterface $response)
890 890
                         {
891 891
                             $json = \GuzzleHttp\json_decode($response->getBody()->getContents(), true);
892
-                            return array_map(static function (array $v) {
892
+                            return array_map(static function(array $v) {
893 893
                                 return $v['s'];
894 894
                             }, $json);
895 895
                         }
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
             'gl' => $country,
944 944
             'price' => $price->value(),
945 945
         ];
946
-        $url = self::GOOGLE_PLAY_URL . '/store/search?' . http_build_query($params);
946
+        $url = self::GOOGLE_PLAY_URL.'/store/search?'.http_build_query($params);
947 947
 
948 948
         $httpClient = $this->getHttpClient();
949 949
         try {
@@ -997,11 +997,11 @@  discard block
 block discarded – undo
997 997
         $locale = LocaleHelper::getNormalizeLocale($locale ?? $this->defaultLocale);
998 998
         $country = $country ?? $this->defaultCountry;
999 999
 
1000
-        $url = self::GOOGLE_PLAY_APPS_URL . '';
1000
+        $url = self::GOOGLE_PLAY_APPS_URL.'';
1001 1001
         if ($category !== null) {
1002
-            $url .= '/category/' . $category->value();
1002
+            $url .= '/category/'.$category->value();
1003 1003
         }
1004
-        $url .= '/collection/' . $collection->value();
1004
+        $url .= '/collection/'.$collection->value();
1005 1005
 
1006 1006
         $offset = 0;
1007 1007
 
@@ -1071,14 +1071,14 @@  discard block
 block discarded – undo
1071 1071
         $mapping = [];
1072 1072
         foreach ($images as $image) {
1073 1073
             if (!$image instanceof GoogleImage) {
1074
-                throw new \InvalidArgumentException('An array of ' . GoogleImage::class . ' objects is expected.');
1074
+                throw new \InvalidArgumentException('An array of '.GoogleImage::class.' objects is expected.');
1075 1075
             }
1076 1076
             $destPath = $destPathFn($image);
1077 1077
             $mapping[$destPath] = $image->getUrl();
1078 1078
         }
1079 1079
 
1080 1080
         $httpClient = $this->getHttpClient();
1081
-        $promises = (static function () use ($mapping, $overwrite, $httpClient) {
1081
+        $promises = (static function() use ($mapping, $overwrite, $httpClient) {
1082 1082
             foreach ($mapping as $destPath => $url) {
1083 1083
                 if (!$overwrite && is_file($destPath)) {
1084 1084
                     yield $destPath => new FulfilledPromise($url);
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
                             RequestOptions::SINK => $destPath,
1094 1094
                             RequestOptions::HTTP_ERRORS => true,
1095 1095
                         ])
1096
-                        ->then(static function (
1096
+                        ->then(static function(
1097 1097
                             /** @noinspection PhpUnusedParameterInspection */
1098 1098
                             ResponseInterface $response
1099 1099
                         ) use ($url) {
@@ -1109,10 +1109,10 @@  discard block
 block discarded – undo
1109 1109
         $imageInfoList = [];
1110 1110
         (new EachPromise($promises, [
1111 1111
             'concurrency' => $this->concurrency,
1112
-            'fulfilled' => static function (string $url, string $destPath) use (&$imageInfoList) {
1112
+            'fulfilled' => static function(string $url, string $destPath) use (&$imageInfoList) {
1113 1113
                 $imageInfoList[] = new ImageInfo($url, $destPath);
1114 1114
             },
1115
-            'rejected' => static function (\Throwable $reason, string $key) use ($mapping) {
1115
+            'rejected' => static function(\Throwable $reason, string $key) use ($mapping) {
1116 1116
                 $exceptionUrl = $mapping[$key];
1117 1117
                 foreach ($mapping as $destPath => $url) {
1118 1118
                     if (is_file($destPath)) {
Please login to merge, or discard this patch.