@@ -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 | |
@@ -63,7 +63,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | ]); |