Passed
Push — master ( 641929...562012 )
by Alexey
06:04 queued 12s
created
src/HttpClient/HttpClient.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $stack->push(Middleware::log(new ConsoleLog(), new MessageFormatter($logTemplate)), 'logger');
64 64
             $stack->push(
65 65
                 Middleware::retry(
66
-                    static function (
66
+                    static function(
67 67
                         int $retries,
68 68
                         RequestInterface $request,
69 69
                         ?ResponseInterface $response = null,
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                                 )
78 78
                         );
79 79
                     },
80
-                    static function (int $retries) {
80
+                    static function(int $retries) {
81 81
                         return 2 ** $retries * 1000;
82 82
                     }
83 83
                 ),
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $promise = $this->getRequestPromise($request);
120 120
         $promise->otherwise(
121
-            $onRejected ?? static function (\Throwable $throwable) {
121
+            $onRejected ?? static function(\Throwable $throwable) {
122 122
                 return $throwable;
123 123
             }
124 124
         );
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
         return $this->client
163 163
             ->sendAsync($request->getPsrRequest(), $request->getOptions())
164
-            ->then(function (ResponseInterface $response) use ($request, $cacheKey, $options) {
164
+            ->then(function(ResponseInterface $response) use ($request, $cacheKey, $options) {
165 165
                 $parseResult = $request->getParseHandler()($request->getPsrRequest(), $response, $options);
166 166
                 if ($cacheKey !== null && $parseResult !== null) {
167 167
                     $this->cache->set($cacheKey, $parseResult, $options['cache_ttl']);
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
      */
181 181
     public function requestPool(array $requests, ?\Closure $onRejected = null): array
182 182
     {
183
-        $makeRequests = function () use ($requests): \Generator {
183
+        $makeRequests = function() use ($requests) : \Generator {
184 184
             foreach ($requests as $key => $request) {
185
-                yield $key => function () use ($request): PromiseInterface {
185
+                yield $key => function() use ($request): PromiseInterface {
186 186
                     return $this->getRequestPromise($request);
187 187
                 };
188 188
             }
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
         $results = [];
192 192
         $pool = new Pool($this->client, $makeRequests(), [
193 193
             'concurrency' => $options['concurrency'] ?? self::DEFAULT_CONCURRENCY,
194
-            'fulfilled' => static function ($result, $key) use (&$results): void {
194
+            'fulfilled' => static function($result, $key) use (&$results): void {
195 195
                 $results[$key] = $result;
196 196
             },
197
-            'rejected' => $onRejected ?? static function (\Throwable $throwable, $key): void {
197
+            'rejected' => $onRejected ?? static function(\Throwable $throwable, $key): void {
198 198
                 throw $throwable;
199 199
             },
200 200
         ]);
Please login to merge, or discard this patch.
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.
src/Util/JsonUtil.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
20 20
         if (\is_array($json)) {
21 21
             $return = '';
22 22
             foreach ($json as $key => $i) {
23
-                $return .= self::recursiveJson($i, $path . '[' . $key . ']');
23
+                $return .= self::recursiveJson($i, $path.'['.$key.']');
24 24
             }
25 25
 
26 26
             return $return;
27 27
         }
28 28
 
29
-        return $path . ' => ' . $json . \PHP_EOL;
29
+        return $path.' => '.$json.\PHP_EOL;
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
src/Scraper/ClusterPagesFromClusterResponseScraper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         foreach ($json[0][1] as $items) {
42 42
             $results[] = new ClusterPage(
43 43
                 $items[0][1],
44
-                GPlayApps::GOOGLE_PLAY_URL . $items[0][3][4][2]
44
+                GPlayApps::GOOGLE_PLAY_URL.$items[0][3][4][2]
45 45
             );
46 46
         }
47 47
         $token = $json[0][3][1] ?? null;
Please login to merge, or discard this patch.
src/Scraper/ClusterPagesFromListAppsScraper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                     if (isset($a[0][1], $a[0][3][4][2])) {
47 47
                         $results[] = new ClusterPage(
48 48
                             trim($a[0][1]),
49
-                            GPlayApps::GOOGLE_PLAY_URL . $a[0][3][4][2]
49
+                            GPlayApps::GOOGLE_PLAY_URL.$a[0][3][4][2]
50 50
                         );
51 51
                     }
52 52
                 }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                     if (isset($a[20][0], $a[20][2][4][2])) {
60 60
                         $results[] = new ClusterPage(
61 61
                             trim($a[20][0]),
62
-                            GPlayApps::GOOGLE_PLAY_URL . $a[20][2][4][2]
62
+                            GPlayApps::GOOGLE_PLAY_URL.$a[20][2][4][2]
63 63
                         );
64 64
                     }
65 65
                 }
Please login to merge, or discard this patch.