@@ -37,8 +37,8 @@ |
||
37 | 37 | ->setUrl($request->getUri()->__toString()); |
38 | 38 | } |
39 | 39 | |
40 | - $parseCategories = static function (array $items) use (&$parseCategories) : array { |
|
41 | - return array_reduce($items, static function ($results, $item) use (&$parseCategories) { |
|
40 | + $parseCategories = static function(array $items) use (&$parseCategories) : array { |
|
41 | + return array_reduce($items, static function($results, $item) use (&$parseCategories) { |
|
42 | 42 | if (is_array($item)) { |
43 | 43 | if ( |
44 | 44 | count($item) === 6 && |
@@ -21,8 +21,8 @@ |
||
21 | 21 | $json = \GuzzleHttp\json_decode($contents, true); |
22 | 22 | $data = $json[0][2][0][65]['42656262'][1] ?? []; |
23 | 23 | |
24 | - $parsePermissions = static function (array $items) use (&$parsePermissions) { |
|
25 | - return array_reduce($items, static function ($results, $item) use (&$parsePermissions) { |
|
24 | + $parsePermissions = static function(array $items) use (&$parsePermissions) { |
|
25 | + return array_reduce($items, static function($results, $item) use (&$parsePermissions) { |
|
26 | 26 | if (is_array($item)) { |
27 | 27 | if (count($item) === 3 && is_string($item[0]) && is_string($item[1])) { |
28 | 28 | $results[] = new Permission($item[0], $item[1]); |
@@ -54,14 +54,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -36,7 +36,7 @@ |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | if (isset($scriptDataApps[0][1][0][0][3][4][2])) { |
39 | - return GPlayApps::GOOGLE_PLAY_URL . $scriptDataApps[0][1][0][0][3][4][2]; |
|
39 | + return GPlayApps::GOOGLE_PLAY_URL.$scriptDataApps[0][1][0][0][3][4][2]; |
|
40 | 40 | } |
41 | 41 | return null; |
42 | 42 | } |
@@ -27,10 +27,10 @@ |
||
27 | 27 | $urlComponents = parse_url($url); |
28 | 28 | $query = parse_query($urlComponents['query']); |
29 | 29 | $developerId = $query[GPlayApps::REQ_PARAM_ID]; |
30 | - $url = $urlComponents['scheme'] . '://' |
|
30 | + $url = $urlComponents['scheme'].'://' |
|
31 | 31 | . $urlComponents['host'] |
32 | 32 | . $urlComponents['path'] |
33 | - . '?' . http_build_query([GPlayApps::REQ_PARAM_ID => $developerId]); |
|
33 | + . '?'.http_build_query([GPlayApps::REQ_PARAM_ID => $developerId]); |
|
34 | 34 | |
35 | 35 | $scriptData = ScraperUtil::extractScriptData($response->getBody()->getContents()); |
36 | 36 |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | |
1185 | 1185 | $dateTime = \DateTimeImmutable::createFromFormat( |
1186 | 1186 | 'Y.m.d', |
1187 | - $year . '.' . $month . '.' . $day, |
|
1187 | + $year.'.'.$month.'.'.$day, |
|
1188 | 1188 | new \DateTimeZone('UTC') |
1189 | 1189 | ); |
1190 | 1190 | if ($dateTime !== false) { |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | { |
1203 | 1203 | $dateTime = \DateTimeImmutable::createFromFormat( |
1204 | 1204 | 'U', |
1205 | - (string)$unixTime, |
|
1205 | + (string) $unixTime, |
|
1206 | 1206 | new \DateTimeZone('UTC') |
1207 | 1207 | ); |
1208 | 1208 | return $dateTime === false ? null : $dateTime; |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | $category = $this->extractCategory($scriptDataInfo[0][12][13][0]); |
64 | 64 | $summary = $this->extractSummary($scriptDataInfo); |
65 | 65 | $installs = $scriptDataInfo[0][12][9][2] ?? 0; |
66 | - $score = (float)($scriptDataRating[0][6][0][1] ?? 0); |
|
67 | - $numberVoters = (int)($scriptDataRating[0][6][2][1] ?? 0); |
|
68 | - $numberReviews = (int)($scriptDataRating[0][6][3][1] ?? 0); |
|
66 | + $score = (float) ($scriptDataRating[0][6][0][1] ?? 0); |
|
67 | + $numberVoters = (int) ($scriptDataRating[0][6][2][1] ?? 0); |
|
68 | + $numberReviews = (int) ($scriptDataRating[0][6][3][1] ?? 0); |
|
69 | 69 | $histogramRating = $this->extractHistogramRating($scriptDataRating); |
70 | 70 | $price = $this->extractPrice($scriptDataPrice); |
71 | 71 | $currency = $scriptDataPrice[0][2][0][0][0][1][0][1]; |
72 | 72 | $priceText = $scriptDataPrice[0][2][0][0][0][1][0][2] ?: null; |
73 | 73 | $offersIAPCost = $scriptDataInfo[0][12][12][0] ?? null; |
74 | - $containsAds = (bool)$scriptDataInfo[0][12][14][0]; |
|
74 | + $containsAds = (bool) $scriptDataInfo[0][12][14][0]; |
|
75 | 75 | |
76 | 76 | [$size, $appVersion, $androidVersion] = $scriptDataVersion; |
77 | 77 | if (LocaleHelper::isDependOnDevice($locale, $size)) { |
@@ -201,8 +201,7 @@ discard block |
||
201 | 201 | LocaleHelper::findPreferredLanguage( |
202 | 202 | $locale, |
203 | 203 | $scriptDataInfo[0][19][1] |
204 | - ) : |
|
205 | - null; |
|
204 | + ) : null; |
|
206 | 205 | } |
207 | 206 | |
208 | 207 | /** |
@@ -235,7 +234,7 @@ discard block |
||
235 | 234 | */ |
236 | 235 | private function extractDeveloper(array $scriptDataInfo): Developer |
237 | 236 | { |
238 | - $developerPage = GPlayApps::GOOGLE_PLAY_URL . $scriptDataInfo[0][12][5][5][4][2]; |
|
237 | + $developerPage = GPlayApps::GOOGLE_PLAY_URL.$scriptDataInfo[0][12][5][5][4][2]; |
|
239 | 238 | $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))[GPlayApps::REQ_PARAM_ID]; |
240 | 239 | $developerName = $scriptDataInfo[0][12][5][1]; |
241 | 240 | $developerEmail = $scriptDataInfo[0][12][5][2][0]; |
@@ -261,8 +260,8 @@ discard block |
||
261 | 260 | private function extractCategory(array $data): ?Category |
262 | 261 | { |
263 | 262 | if (isset($data[0]) && $data[0] !== null && $data[2] !== null) { |
264 | - $genreId = (string)$data[2]; |
|
265 | - $genreName = (string)$data[0]; |
|
263 | + $genreId = (string) $data[2]; |
|
264 | + $genreName = (string) $data[0]; |
|
266 | 265 | return new Category($genreId, $genreName); |
267 | 266 | } |
268 | 267 | return null; |
@@ -290,8 +289,7 @@ discard block |
||
290 | 289 | protected function extractPrice(array $scriptDataPrice): ?float |
291 | 290 | { |
292 | 291 | return isset($scriptDataPrice[0][2][0][0][0][1][0][0]) ? |
293 | - (float)($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : |
|
294 | - 0.0; |
|
292 | + (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : 0.0; |
|
295 | 293 | } |
296 | 294 | |
297 | 295 | /** |
@@ -322,7 +320,7 @@ discard block |
||
322 | 320 | */ |
323 | 321 | private function extractScreenshots(array $scriptDataInfo): array |
324 | 322 | { |
325 | - return !empty($scriptDataInfo[0][12][0]) ? array_map(static function (array $v) { |
|
323 | + return !empty($scriptDataInfo[0][12][0]) ? array_map(static function(array $v) { |
|
326 | 324 | return new GoogleImage($v[3][2]); |
327 | 325 | }, $scriptDataInfo[0][12][0]) : []; |
328 | 326 | } |
@@ -338,8 +336,8 @@ discard block |
||
338 | 336 | $scriptDataInfo[0][12][3][0][3][2] !== null && |
339 | 337 | $scriptDataInfo[0][12][3][1][3][2] !== null |
340 | 338 | ) { |
341 | - $videoThumb = (string)$scriptDataInfo[0][12][3][1][3][2]; |
|
342 | - $videoUrl = (string)$scriptDataInfo[0][12][3][0][3][2]; |
|
339 | + $videoThumb = (string) $scriptDataInfo[0][12][3][1][3][2]; |
|
340 | + $videoUrl = (string) $scriptDataInfo[0][12][3][0][3][2]; |
|
343 | 341 | |
344 | 342 | return new Video($videoThumb, $videoUrl); |
345 | 343 | } |
@@ -46,9 +46,9 @@ |
||
46 | 46 | $scriptData = ScraperUtil::extractScriptData($response->getBody()->getContents()); |
47 | 47 | foreach ($scriptData as $key => $scriptValue) { |
48 | 48 | if (isset($scriptValue[1][1][0][0][3][4][2])) { |
49 | - return GPlayApps::GOOGLE_PLAY_URL . $scriptValue[1][1][0][0][3][4][2] . |
|
50 | - '&' . GPlayApps::REQ_PARAM_LOCALE . '=' . urlencode($this->appId->getLocale()) . |
|
51 | - '&' . GPlayApps::REQ_PARAM_COUNTRY . '=' . urlencode($this->appId->getCountry()); |
|
49 | + return GPlayApps::GOOGLE_PLAY_URL.$scriptValue[1][1][0][0][3][4][2]. |
|
50 | + '&'.GPlayApps::REQ_PARAM_LOCALE.'='.urlencode($this->appId->getLocale()). |
|
51 | + '&'.GPlayApps::REQ_PARAM_COUNTRY.'='.urlencode($this->appId->getCountry()); |
|
52 | 52 | break; |
53 | 53 | } |
54 | 54 | } |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | 'soc-platform' => 1, |
37 | 37 | 'soc-device' => 1, |
38 | 38 | ]; |
39 | - $url = GPlayApps::GOOGLE_PLAY_URL . '/_/PlayStoreUi/data/batchexecute?' . http_build_query($queryParams); |
|
39 | + $url = GPlayApps::GOOGLE_PLAY_URL.'/_/PlayStoreUi/data/batchexecute?'.http_build_query($queryParams); |
|
40 | 40 | $formParams = [ |
41 | - 'f.req' => '[[["' . self::RPC_ID_REVIEWS . '","[null,null,[2,' . $sort->value() . ',[' . $limit . ',null,' . ($token === null ? 'null' : '\\"' . $token . '\\"') . ']],[\\"' . $requestApp->getId() . '\\",7]]",null,"generic"]]]', |
|
41 | + 'f.req' => '[[["'.self::RPC_ID_REVIEWS.'","[null,null,[2,'.$sort->value().',['.$limit.',null,'.($token === null ? 'null' : '\\"'.$token.'\\"').']],[\\"'.$requestApp->getId().'\\",7]]",null,"generic"]]]', |
|
42 | 42 | ]; |
43 | 43 | $headers = [ |
44 | 44 | 'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8', |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | 'soc-platform' => 1, |
66 | 66 | 'soc-device' => 1, |
67 | 67 | ]; |
68 | - $url = GPlayApps::GOOGLE_PLAY_URL . '/_/PlayStoreUi/data/batchexecute?' . http_build_query($queryParams); |
|
68 | + $url = GPlayApps::GOOGLE_PLAY_URL.'/_/PlayStoreUi/data/batchexecute?'.http_build_query($queryParams); |
|
69 | 69 | $formParams = [ |
70 | - 'f.req' => '[[["' . self::RPC_ID_APPS . '","[[null,[[10,[10,' . $limit . ']],true,null,[1]],null,\\"' . $token . '\\"]]",null,"generic"]]]', |
|
70 | + 'f.req' => '[[["'.self::RPC_ID_APPS.'","[[null,[[10,[10,'.$limit.']],true,null,[1]],null,\\"'.$token.'\\"]]",null,"generic"]]]', |
|
71 | 71 | ]; |
72 | 72 | $headers = [ |
73 | 73 | 'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8', |