Passed
Push — master ( 80ad96...45165d )
by Alexey
03:00
created
src/Model/ImageInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $this->url = $url;
46 46
         $imageInfo = getimagesize($path);
47 47
         if (!$imageInfo) {
48
-            throw new \RuntimeException('Invalid image: ' . $path);
48
+            throw new \RuntimeException('Invalid image: '.$path);
49 49
         }
50 50
         $this->path = $path;
51 51
         $this->mimeType = $imageInfo['mime'];
Please login to merge, or discard this patch.
src/Util/DateStringFormatter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1184,7 +1184,7 @@
 block discarded – undo
1184 1184
 
1185 1185
             $dateTime = \DateTimeImmutable::createFromFormat(
1186 1186
                 'Y.m.d',
1187
-                $year . '.' . $month . '.' . $day
1187
+                $year.'.'.$month.'.'.$day
1188 1188
             );
1189 1189
             if ($dateTime !== false) {
1190 1190
                 return $dateTime;
Please login to merge, or discard this patch.
src/Util/ScraperUtil.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     {
14 14
         $scripts = [];
15 15
         if (preg_match_all('/>AF_initDataCallback[\s\S]*?<\/script/', $html, $matches)) {
16
-            $scripts = array_reduce($matches[0], static function ($carry, $item) {
16
+            $scripts = array_reduce($matches[0], static function($carry, $item) {
17 17
                 if (
18 18
                     preg_match("/(ds:.*?)'/", $item, $keyMatch) &&
19 19
                     preg_match('/return ([\s\S]*?)}}\);<\//', $item, $valueMatch)
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $doc = new \DOMDocument();
36 36
         $internalErrors = libxml_use_internal_errors(true);
37
-        if (!$doc->loadHTML('<?xml encoding="utf-8" ?>' . $html)) {
38
-            throw new \RuntimeException('error load html: ' . $html);
37
+        if (!$doc->loadHTML('<?xml encoding="utf-8" ?>'.$html)) {
38
+            throw new \RuntimeException('error load html: '.$html);
39 39
         }
40 40
         libxml_use_internal_errors($internalErrors);
41 41
         $text = self::convertDomNodeToText($doc);
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
                 case 'p':
70 70
                 case 'ul':
71 71
                 case 'div':
72
-                    $text = "\n\n" . $text . "\n\n";
72
+                    $text = "\n\n".$text."\n\n";
73 73
                     break;
74 74
                 case 'li':
75
-                    $text = '- ' . $text . "\n";
75
+                    $text = '- '.$text."\n";
76 76
                     break;
77 77
                 case 'br':
78 78
                     $text .= "\n";
Please login to merge, or discard this patch.
src/Http/HttpClient.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 
55 55
         $handlerStack = HandlerStack::create();
56 56
         $handlerStack->unshift(
57
-            function (callable $handler) {
58
-                return function (RequestInterface $request, array $options) use ($handler) {
57
+            function(callable $handler) {
58
+                return function(RequestInterface $request, array $options) use ($handler) {
59 59
                     if (!isset($options[self::OPTION_HANDLER_RESPONSE])) {
60 60
                         return $handler($request, $options);
61 61
                     }
62 62
 
63 63
                     if (!$options[self::OPTION_HANDLER_RESPONSE] instanceof ResponseHandlerInterface) {
64
-                        throw new \RuntimeException("'" . self::OPTION_HANDLER_RESPONSE . "' option is not implements " . ResponseHandlerInterface::class);
64
+                        throw new \RuntimeException("'".self::OPTION_HANDLER_RESPONSE."' option is not implements ".ResponseHandlerInterface::class);
65 65
                     }
66 66
 
67 67
                     if ($this->cache !== null) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                                         throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
89 89
                                     }
90 90
                                 }
91
-                                $handlerHash = (string)$hashes[$func];
91
+                                $handlerHash = (string) $hashes[$func];
92 92
                             } else {
93 93
                                 $handlerHash = $ref->getName();
94 94
                             }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
                     return $handler($request, $options)
110 110
                         ->then(
111
-                            function (ResponseInterface $response) use ($options, $request) {
111
+                            function(ResponseInterface $response) use ($options, $request) {
112 112
                                 $result = call_user_func(
113 113
                                     $options[self::OPTION_HANDLER_RESPONSE],
114 114
                                     $request,
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         );
134 134
         $handlerStack->push(
135 135
             Middleware::retry(
136
-                function (
136
+                function(
137 137
                     $retries,
138 138
                     /** @noinspection PhpUnusedParameterInspection */
139 139
                     RequestInterface $request,
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                     }
161 161
                     return false;
162 162
                 },
163
-                static function (int $numberOfRetries) {
163
+                static function(int $numberOfRetries) {
164 164
                     // retry delay
165 165
                     return 1000 * $numberOfRetries;
166 166
                 }
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
     {
290 290
         $data = [
291 291
             $request->getMethod(),
292
-            (string)$request->getUri(),
292
+            (string) $request->getUri(),
293 293
             $request->getBody()->getContents(),
294 294
         ];
295 295
         foreach ($request->getHeaders() as $name => $header) {
296
-            $data[] = $name . ': ' . implode(', ', $header);
296
+            $data[] = $name.': '.implode(', ', $header);
297 297
         }
298 298
         $data[] = $request->getBody()->getContents();
299 299
         return hash('crc32b', implode("\n", $data));
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         if (!$urls instanceof \Generator) {
314 314
             $urls = $this->requestGenerator($method, $urls, $options);
315 315
         }
316
-        each_limit_all($urls, $concurrency, static function ($response, $index) use (&$results) {
316
+        each_limit_all($urls, $concurrency, static function($response, $index) use (&$results) {
317 317
             $results[$index] = $response;
318 318
         })->wait();
319 319
         return $results;
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
@@ -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(),
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         // sorting array keys; the first key is the preferred locale
323 323
         uksort(
324 324
             $list,
325
-            static function (
325
+            static function(
326 326
                 /** @noinspection PhpUnusedParameterInspection */
327 327
                 string $a,
328 328
                 string $b
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
     public function existsApp($requestApp): bool
345 345
     {
346 346
         $requestApp = $this->castToRequestApp($requestApp);
347
-        $url = self::GOOGLE_PLAY_APPS_URL . '/details';
347
+        $url = self::GOOGLE_PLAY_APPS_URL.'/details';
348 348
 
349 349
         try {
350
-            return (bool)$this->getHttpClient()->request('HEAD', $url, [
350
+            return (bool) $this->getHttpClient()->request('HEAD', $url, [
351 351
                 RequestOptions::QUERY => [
352 352
                     self::REQ_PARAM_APP_ID => $requestApp->getId(),
353 353
                     self::REQ_PARAM_LOCALE => $requestApp->getLocale(),
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         $sort = $sort ?? SortEnum::NEWEST();
417 417
         $page = max(0, $page);
418 418
 
419
-        $url = self::GOOGLE_PLAY_URL . '/store/getreviews';
419
+        $url = self::GOOGLE_PLAY_URL.'/store/getreviews';
420 420
         $formParams = [
421 421
             self::REQ_PARAM_APP_ID => $requestApp->getId(),
422 422
             self::REQ_PARAM_LOCALE => $requestApp->getLocale(),
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             self::REQ_PARAM_LOCALE => $requestApp->getLocale(),
508 508
             self::REQ_PARAM_COUNTRY => $requestApp->getCountry(),
509 509
         ];
510
-        $url = self::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query($params);
510
+        $url = self::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query($params);
511 511
         $httpClient = $this->getHttpClient();
512 512
         try {
513 513
             return $httpClient->request(
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
     {
540 540
         $requestApp = $this->castToRequestApp($requestApp);
541 541
 
542
-        $url = self::GOOGLE_PLAY_URL . '/store/xhr/getdoc?authuser=0';
542
+        $url = self::GOOGLE_PLAY_URL.'/store/xhr/getdoc?authuser=0';
543 543
         try {
544 544
             return $this->getHttpClient()->request(
545 545
                 'POST',
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
         $urls = [];
606 606
         $url = self::GOOGLE_PLAY_APPS_URL;
607 607
         foreach ($locales as $locale) {
608
-            $urls[$locale] = $url . '?' . http_build_query([
608
+            $urls[$locale] = $url.'?'.http_build_query([
609 609
                     self::REQ_PARAM_LOCALE => $locale,
610 610
                 ]);
611 611
         }
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
         }
653 653
 
654 654
         $locale = LocaleHelper::getNormalizeLocale($locale ?? $this->defaultLocale);
655
-        $url = self::GOOGLE_PLAY_APPS_URL . '/dev';
655
+        $url = self::GOOGLE_PLAY_APPS_URL.'/dev';
656 656
         try {
657 657
             return $this->getHttpClient()->request(
658 658
                 'GET',
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
             return $developerId;
681 681
         }
682 682
         if (is_int($developerId)) {
683
-            return (string)$developerId;
683
+            return (string) $developerId;
684 684
         }
685 685
         if ($developerId instanceof App) {
686 686
             return $developerId->getDeveloper()->getId();
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
         }
714 714
 
715 715
         $urls = [];
716
-        $url = self::GOOGLE_PLAY_APPS_URL . '/dev';
716
+        $url = self::GOOGLE_PLAY_APPS_URL.'/dev';
717 717
         foreach ($locales as $locale) {
718
-            $urls[$locale] = $url . '?' . http_build_query([
718
+            $urls[$locale] = $url.'?'.http_build_query([
719 719
                     self::REQ_PARAM_APP_ID => $id,
720 720
                     self::REQ_PARAM_LOCALE => $locale,
721 721
                 ]);
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
         $preferredLocale = self::DEFAULT_LOCALE;
751 751
 
752 752
         $preferredInfo = $list[$preferredLocale];
753
-        $list = array_filter($list, static function (Developer $info, string $locale) use ($preferredInfo, $preferredLocale) {
753
+        $list = array_filter($list, static function(Developer $info, string $locale) use ($preferredInfo, $preferredLocale) {
754 754
             return $locale === $preferredLocale || $preferredInfo->equals($info);
755 755
         }, ARRAY_FILTER_USE_BOTH);
756 756
 
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 
801 801
         try {
802 802
             if (is_numeric($developerId)) {
803
-                $url = self::GOOGLE_PLAY_APPS_URL . '/dev';
803
+                $url = self::GOOGLE_PLAY_APPS_URL.'/dev';
804 804
                 return $httpClient->request(
805 805
                     'GET',
806 806
                     $url,
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
                 );
817 817
             }
818 818
 
819
-            $url = self::GOOGLE_PLAY_APPS_URL . '/developer';
819
+            $url = self::GOOGLE_PLAY_APPS_URL.'/developer';
820 820
             return $httpClient->request(
821 821
                 'GET',
822 822
                 $url,
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
                         public function __invoke(RequestInterface $request, ResponseInterface $response)
879 879
                         {
880 880
                             $json = \GuzzleHttp\json_decode($response->getBody()->getContents(), true);
881
-                            return array_map(static function (array $v) {
881
+                            return array_map(static function(array $v) {
882 882
                                 return $v['s'];
883 883
                             }, $json);
884 884
                         }
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
             'gl' => $country,
932 932
             'price' => $price->value(),
933 933
         ];
934
-        $url = self::GOOGLE_PLAY_URL . '/store/search?' . http_build_query($params);
934
+        $url = self::GOOGLE_PLAY_URL.'/store/search?'.http_build_query($params);
935 935
 
936 936
         $httpClient = $this->getHttpClient();
937 937
         try {
@@ -984,11 +984,11 @@  discard block
 block discarded – undo
984 984
         $locale = LocaleHelper::getNormalizeLocale($locale ?? $this->defaultLocale);
985 985
         $country = $country ?? $this->defaultCountry;
986 986
 
987
-        $url = self::GOOGLE_PLAY_APPS_URL . '';
987
+        $url = self::GOOGLE_PLAY_APPS_URL.'';
988 988
         if ($category !== null) {
989
-            $url .= '/category/' . $category->value();
989
+            $url .= '/category/'.$category->value();
990 990
         }
991
-        $url .= '/collection/' . $collection->value();
991
+        $url .= '/collection/'.$collection->value();
992 992
 
993 993
         $offset = 0;
994 994
 
@@ -1057,14 +1057,14 @@  discard block
 block discarded – undo
1057 1057
         $mapping = [];
1058 1058
         foreach ($images as $image) {
1059 1059
             if (!$image instanceof GoogleImage) {
1060
-                throw new \InvalidArgumentException('An array of ' . GoogleImage::class . ' objects is expected.');
1060
+                throw new \InvalidArgumentException('An array of '.GoogleImage::class.' objects is expected.');
1061 1061
             }
1062 1062
             $destPath = $destPathFn($image);
1063 1063
             $mapping[$destPath] = $image->getUrl();
1064 1064
         }
1065 1065
 
1066 1066
         $httpClient = $this->getHttpClient();
1067
-        $promises = (static function () use ($mapping, $overwrite, $httpClient) {
1067
+        $promises = (static function() use ($mapping, $overwrite, $httpClient) {
1068 1068
             foreach ($mapping as $destPath => $url) {
1069 1069
                 if (!$overwrite && is_file($destPath)) {
1070 1070
                     yield $destPath => new FulfilledPromise($url);
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
                             RequestOptions::SINK => $destPath,
1080 1080
                             RequestOptions::HTTP_ERRORS => true,
1081 1081
                         ])
1082
-                        ->then(static function (
1082
+                        ->then(static function(
1083 1083
                             /** @noinspection PhpUnusedParameterInspection */
1084 1084
                             ResponseInterface $response
1085 1085
                         ) use ($url) {
@@ -1095,10 +1095,10 @@  discard block
 block discarded – undo
1095 1095
         $imageInfoList = [];
1096 1096
         (new EachPromise($promises, [
1097 1097
             'concurrency' => $this->concurrency,
1098
-            'fulfilled' => static function (string $url, string $destPath) use (&$imageInfoList) {
1098
+            'fulfilled' => static function(string $url, string $destPath) use (&$imageInfoList) {
1099 1099
                 $imageInfoList[] = new ImageInfo($url, $destPath);
1100 1100
             },
1101
-            'rejected' => static function (\Throwable $reason, string $key) use ($mapping) {
1101
+            'rejected' => static function(\Throwable $reason, string $key) use ($mapping) {
1102 1102
                 $exceptionUrl = $mapping[$key];
1103 1103
                 foreach ($mapping as $destPath => $url) {
1104 1104
                     if (is_file($destPath)) {
Please login to merge, or discard this patch.