@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $json = \GuzzleHttp\json_decode($contents, true); |
35 | 35 | $data = \GuzzleHttp\json_decode($json[0][2], true); |
36 | 36 | |
37 | - $permissionMapFn = static function (array $v): string { |
|
37 | + $permissionMapFn = static function(array $v): string { |
|
38 | 38 | return (string) $v[1]; |
39 | 39 | }; |
40 | 40 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | return array_map( |
68 | - static function (array $data) { |
|
68 | + static function(array $data) { |
|
69 | 69 | return new Permission($data['name'], $data['icon'], $data['permissions']); |
70 | 70 | }, |
71 | 71 | $permissions |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getUrl(): string |
101 | 101 | { |
102 | - return GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query( |
|
102 | + return GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query( |
|
103 | 103 | [ |
104 | 104 | GPlayApps::REQ_PARAM_ID => $this->id, |
105 | 105 | ] |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getFullUrl(): string |
117 | 117 | { |
118 | - return GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query( |
|
118 | + return GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query( |
|
119 | 119 | [ |
120 | 120 | GPlayApps::REQ_PARAM_ID => $this->id, |
121 | 121 | GPlayApps::REQ_PARAM_LOCALE => $this->locale, |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $imageInfo = getimagesize($filename); |
52 | 52 | |
53 | 53 | if (!$imageInfo) { |
54 | - throw new \RuntimeException('Invalid image: ' . $filename); |
|
54 | + throw new \RuntimeException('Invalid image: '.$filename); |
|
55 | 55 | } |
56 | 56 | $this->filename = $filename; |
57 | 57 | $this->mimeType = $imageInfo['mime']; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | $json = \GuzzleHttp\json_decode($contents, true); |
26 | 26 | $suggests = \GuzzleHttp\json_decode($json[0][2], true); |
27 | 27 | |
28 | - return array_map(static function (array $suggest): string { |
|
28 | + return array_map(static function(array $suggest): string { |
|
29 | 29 | return (string) $suggest[0]; |
30 | 30 | }, $suggests[0][0] ?? []); |
31 | 31 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | $parts = \array_slice($parts, 0, 4); |
188 | 188 | $path = implode('/', $parts); |
189 | - $url = $httpComponents['scheme'] . '://' . $httpComponents['host'] . '/' . $path . '/'; |
|
189 | + $url = $httpComponents['scheme'].'://'.$httpComponents['host'].'/'.$path.'/'; |
|
190 | 190 | $this->variantOfUrlWithFileName = true; |
191 | 191 | } elseif (($pos = strpos($url, '=')) !== false) { |
192 | 192 | $paramString = substr($url, $pos + 1); |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | $params = []; |
291 | 291 | |
292 | 292 | if ($this->size !== null) { |
293 | - $params[] = self::PARAM_SIZE . $this->size; |
|
293 | + $params[] = self::PARAM_SIZE.$this->size; |
|
294 | 294 | } else { |
295 | 295 | if ($this->width !== null) { |
296 | - $params[] = self::PARAM_WIDTH . $this->width; |
|
296 | + $params[] = self::PARAM_WIDTH.$this->width; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | if ($this->height !== null) { |
300 | - $params[] = self::PARAM_HEIGHT . $this->height; |
|
300 | + $params[] = self::PARAM_HEIGHT.$this->height; |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | return $this->baseUrl; |
313 | 313 | } |
314 | 314 | |
315 | - return $this->baseUrl . implode('-', $params) . '/'; |
|
315 | + return $this->baseUrl.implode('-', $params).'/'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | if ($this->border !== null) { |
319 | - $params[] = self::PARAM_BORDER . $this->border; |
|
319 | + $params[] = self::PARAM_BORDER.$this->border; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | if ($this->verticalFlip) { |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | return $this->baseUrl; |
332 | 332 | } |
333 | 333 | |
334 | - return $this->baseUrl . '=' . implode('-', $params); |
|
334 | + return $this->baseUrl.'='.implode('-', $params); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function getOriginalSizeUrl(): string |
355 | 355 | { |
356 | - $params = [self::PARAM_SIZE . '0']; |
|
356 | + $params = [self::PARAM_SIZE.'0']; |
|
357 | 357 | |
358 | 358 | if ($this->variantOfUrlWithFileName) { |
359 | - return $this->baseUrl . implode('-', $params) . '/'; |
|
359 | + return $this->baseUrl.implode('-', $params).'/'; |
|
360 | 360 | } |
361 | 361 | |
362 | - return $this->baseUrl . '=' . implode('-', $params); |
|
362 | + return $this->baseUrl.'='.implode('-', $params); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | for ($i = 0; $i < $parts; ++$i) { |
385 | 385 | $partsBuild[] = substr($hash, $i * $partLength, $partLength); |
386 | 386 | } |
387 | - $hash = implode('/', $partsBuild) . '/' . $hash; |
|
387 | + $hash = implode('/', $partsBuild).'/'.$hash; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | return $hash; |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | RequestOptions::COOKIES => null, |
650 | 650 | RequestOptions::HTTP_ERRORS => true, |
651 | 651 | RequestOptions::SINK => $stream, |
652 | - RequestOptions::ON_HEADERS => static function (ResponseInterface $response) use ( |
|
652 | + RequestOptions::ON_HEADERS => static function(ResponseInterface $response) use ( |
|
653 | 653 | $url, |
654 | 654 | $stream |
655 | 655 | ): void { |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | $contentType = $response->getHeaderLine('Content-Type'); |
689 | 689 | |
690 | 690 | if (!preg_match('~\bimage/.*\b~i', $contentType, $match)) { |
691 | - throw new GooglePlayException('Url ' . $url . ' is not image'); |
|
691 | + throw new GooglePlayException('Url '.$url.' is not image'); |
|
692 | 692 | } |
693 | 693 | $contentType = $match[0]; |
694 | 694 | $imageType = self::getImageExtension($contentType); |
@@ -21,9 +21,9 @@ |
||
21 | 21 | public function log($level, $message, array $context = []): void |
22 | 22 | { |
23 | 23 | $stream = LogLevel::DEBUG === $level || LogLevel::INFO === $level ? \STDOUT : \STDERR; |
24 | - fwrite($stream, '[' . strtoupper($level) . '] ' . $message . \PHP_EOL); |
|
24 | + fwrite($stream, '['.strtoupper($level).'] '.$message.\PHP_EOL); |
|
25 | 25 | if (!empty($context)) { |
26 | - fwrite($stream, var_export($context, true) . \PHP_EOL); |
|
26 | + fwrite($stream, var_export($context, true).\PHP_EOL); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | hash_update($ctx, (string) $request->getUri()); |
33 | 33 | |
34 | 34 | foreach ($request->getHeaders() as $name => $header) { |
35 | - hash_update($ctx, $name . ': ' . implode(', ', $header)); |
|
35 | + hash_update($ctx, $name.': '.implode(', ', $header)); |
|
36 | 36 | } |
37 | 37 | hash_update($ctx, $request->getBody()->getContents()); |
38 | 38 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | } else { |
120 | 120 | hash_update( |
121 | 121 | $ctx, |
122 | - $ref->getName() . \PHP_EOL |
|
123 | - . $ref->getFileName() . \PHP_EOL |
|
122 | + $ref->getName().\PHP_EOL |
|
123 | + . $ref->getFileName().\PHP_EOL |
|
124 | 124 | . filemtime($ref->getFileName()) |
125 | 125 | ); |
126 | 126 | } |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | if ($ref->isUserDefined()) { |
148 | 148 | $hashes[$ref->getName()] = hash( |
149 | 149 | $hashAlgo, |
150 | - $ref->getName() . \PHP_EOL |
|
151 | - . $ref->getFileName() . \PHP_EOL |
|
150 | + $ref->getName().\PHP_EOL |
|
151 | + . $ref->getFileName().\PHP_EOL |
|
152 | 152 | . filemtime($ref->getFileName()) |
153 | 153 | ); |
154 | 154 | } else { |
@@ -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 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public const GOOGLE_PLAY_URL = 'https://play.google.com'; |
42 | 42 | |
43 | 43 | /** @var string Google Play apps url. */ |
44 | - public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL . '/store/apps'; |
|
44 | + public const GOOGLE_PLAY_APPS_URL = self::GOOGLE_PLAY_URL.'/store/apps'; |
|
45 | 45 | |
46 | 46 | /** @var int Unlimit results. */ |
47 | 47 | public const UNLIMIT = -1; |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | $parseHandler = new Scraper\ExistsAppScraper(); |
328 | - $requests = array_map(function ($appId) use ($parseHandler) { |
|
328 | + $requests = array_map(function($appId) use ($parseHandler) { |
|
329 | 329 | $fullUrl = Util\Caster::castToAppId($appId, $this->defaultLocale, $this->defaultCountry)->getFullUrl(); |
330 | 330 | $psrRequest = new PsrRequest('HEAD', $fullUrl); |
331 | 331 | |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public function getCategories(): array |
456 | 456 | { |
457 | - return array_map(static function (CategoryEnum $category) { |
|
457 | + return array_map(static function(CategoryEnum $category) { |
|
458 | 458 | $categoryName = $category->value(); |
459 | 459 | $categoryName = str_replace('_', ' ', $categoryName); |
460 | 460 | $categoryName = ucfirst(strtolower($categoryName)); |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | ); |
493 | 493 | } |
494 | 494 | |
495 | - $url = self::GOOGLE_PLAY_APPS_URL . '/dev?' . http_build_query([ |
|
495 | + $url = self::GOOGLE_PLAY_APPS_URL.'/dev?'.http_build_query([ |
|
496 | 496 | self::REQ_PARAM_ID => $developerId, |
497 | 497 | self::REQ_PARAM_LOCALE => $this->defaultLocale, |
498 | 498 | ]); |
@@ -548,11 +548,11 @@ discard block |
||
548 | 548 | } |
549 | 549 | |
550 | 550 | $requests = []; |
551 | - $url = self::GOOGLE_PLAY_APPS_URL . '/dev'; |
|
551 | + $url = self::GOOGLE_PLAY_APPS_URL.'/dev'; |
|
552 | 552 | $parseHandler = new Scraper\DeveloperInfoScraper(); |
553 | 553 | |
554 | 554 | foreach ($locales as $locale) { |
555 | - $requestUrl = $url . '?' . http_build_query( |
|
555 | + $requestUrl = $url.'?'.http_build_query( |
|
556 | 556 | [ |
557 | 557 | self::REQ_PARAM_ID => $id, |
558 | 558 | self::REQ_PARAM_LOCALE => $locale, |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | ]; |
597 | 597 | |
598 | 598 | if (is_numeric($developerId)) { |
599 | - $developerUrl = self::GOOGLE_PLAY_APPS_URL . '/dev?' . http_build_query($query); |
|
599 | + $developerUrl = self::GOOGLE_PLAY_APPS_URL.'/dev?'.http_build_query($query); |
|
600 | 600 | |
601 | 601 | try { |
602 | 602 | /** |
@@ -614,13 +614,13 @@ discard block |
||
614 | 614 | return []; |
615 | 615 | } |
616 | 616 | |
617 | - $developerUrl .= '&' . self::REQ_PARAM_LOCALE . '=' . urlencode($this->defaultLocale) |
|
618 | - . '&' . self::REQ_PARAM_COUNTRY . '=' . urlencode($this->defaultCountry); |
|
617 | + $developerUrl .= '&'.self::REQ_PARAM_LOCALE.'='.urlencode($this->defaultLocale) |
|
618 | + . '&'.self::REQ_PARAM_COUNTRY.'='.urlencode($this->defaultCountry); |
|
619 | 619 | } catch (\Throwable $e) { |
620 | 620 | throw new Exception\GooglePlayException($e->getMessage(), 1, $e); |
621 | 621 | } |
622 | 622 | } else { |
623 | - $developerUrl = self::GOOGLE_PLAY_APPS_URL . '/developer?' . http_build_query($query); |
|
623 | + $developerUrl = self::GOOGLE_PLAY_APPS_URL.'/developer?'.http_build_query($query); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | return $this->fetchAppsFromClusterPage( |
@@ -795,9 +795,9 @@ discard block |
||
795 | 795 | $url = self::GOOGLE_PLAY_APPS_URL; |
796 | 796 | |
797 | 797 | if ($category !== null) { |
798 | - $url .= '/category/' . Util\Caster::castToCategoryId($category); |
|
798 | + $url .= '/category/'.Util\Caster::castToCategoryId($category); |
|
799 | 799 | } |
800 | - $url .= '?' . http_build_query($queryParams); |
|
800 | + $url .= '?'.http_build_query($queryParams); |
|
801 | 801 | |
802 | 802 | ['results' => $results, 'token' => $token] = $this->getHttpClient()->request( |
803 | 803 | new Request( |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | self::REQ_PARAM_COUNTRY => $this->defaultCountry, |
910 | 910 | 'price' => $price->value(), |
911 | 911 | ]; |
912 | - $clusterPageUrl = self::GOOGLE_PLAY_URL . '/store/search?' . http_build_query($params); |
|
912 | + $clusterPageUrl = self::GOOGLE_PLAY_URL.'/store/search?'.http_build_query($params); |
|
913 | 913 | |
914 | 914 | $apps = []; |
915 | 915 | $count = 0; |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | foreach ($images as $image) { |
1150 | 1150 | if (!$image instanceof Model\GoogleImage) { |
1151 | 1151 | throw new \InvalidArgumentException( |
1152 | - 'An array of ' . Model\GoogleImage::class . ' objects is expected.' |
|
1152 | + 'An array of '.Model\GoogleImage::class.' objects is expected.' |
|
1153 | 1153 | ); |
1154 | 1154 | } |
1155 | 1155 | $destPath = $destPathCallback($image); |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | } |
1159 | 1159 | |
1160 | 1160 | $httpClient = $this->getHttpClient(); |
1161 | - $promises = (static function () use ($mapping, $overwrite, $httpClient) { |
|
1161 | + $promises = (static function() use ($mapping, $overwrite, $httpClient) { |
|
1162 | 1162 | foreach ($mapping as $url => $stream) { |
1163 | 1163 | $destPath = $stream->getFilename(); |
1164 | 1164 | $dynamicPath = strpos($destPath, '{url}') !== false; |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | RequestOptions::COOKIES => null, |
1175 | 1175 | RequestOptions::SINK => $stream, |
1176 | 1176 | RequestOptions::HTTP_ERRORS => true, |
1177 | - RequestOptions::ON_HEADERS => static function (ResponseInterface $response) use ( |
|
1177 | + RequestOptions::ON_HEADERS => static function(ResponseInterface $response) use ( |
|
1178 | 1178 | $url, |
1179 | 1179 | $stream |
1180 | 1180 | ): void { |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | ] |
1184 | 1184 | ) |
1185 | 1185 | ->then( |
1186 | - static function ( |
|
1186 | + static function( |
|
1187 | 1187 | /** @noinspection PhpUnusedParameterInspection */ |
1188 | 1188 | ResponseInterface $response |
1189 | 1189 | ) use ($url) { |
@@ -1203,10 +1203,10 @@ discard block |
||
1203 | 1203 | $promises, |
1204 | 1204 | [ |
1205 | 1205 | 'concurrency' => $this->getHttpClient()->getConcurrency(), |
1206 | - 'fulfilled' => static function (string $url) use (&$imageInfoList, $mapping): void { |
|
1206 | + 'fulfilled' => static function(string $url) use (&$imageInfoList, $mapping): void { |
|
1207 | 1207 | $imageInfoList[] = new Model\ImageInfo($url, $mapping[$url]->getFilename()); |
1208 | 1208 | }, |
1209 | - 'rejected' => static function (\Throwable $reason, string $exceptionUrl) use ($mapping): void { |
|
1209 | + 'rejected' => static function(\Throwable $reason, string $exceptionUrl) use ($mapping): void { |
|
1210 | 1210 | foreach ($mapping as $destPath => $url) { |
1211 | 1211 | if (is_file($destPath)) { |
1212 | 1212 | unlink($destPath); |