@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if (preg_match_all('/>AF_initDataCallback[\s\S]*?<\/script/', $html, $matches)) { |
29 | 29 | $scripts = array_reduce( |
30 | 30 | $matches[0], |
31 | - static function ($carry, $item) { |
|
31 | + static function($carry, $item) { |
|
32 | 32 | if ( |
33 | 33 | preg_match("/(ds:.*?)'/", $item, $keyMatch) && |
34 | 34 | preg_match('/data:([\s\S]*?)}\);<\//', $item, $valueMatch) |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | $doc = new \DOMDocument(); |
56 | 56 | $internalErrors = libxml_use_internal_errors(true); |
57 | 57 | |
58 | - if (!$doc->loadHTML('<?xml encoding="utf-8"?>' . $html)) { |
|
58 | + if (!$doc->loadHTML('<?xml encoding="utf-8"?>'.$html)) { |
|
59 | 59 | throw new |
60 | 60 | \RuntimeException( |
61 | - 'error load html: ' . $html |
|
61 | + 'error load html: '.$html |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | libxml_use_internal_errors($internalErrors); |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | case 'p': |
109 | 109 | case 'ul': |
110 | 110 | case 'div': |
111 | - $text = "\n\n" . $text . "\n\n"; |
|
111 | + $text = "\n\n".$text."\n\n"; |
|
112 | 112 | break; |
113 | 113 | |
114 | 114 | case 'li': |
115 | - $text = '- ' . $text . "\n"; |
|
115 | + $text = '- '.$text."\n"; |
|
116 | 116 | break; |
117 | 117 | |
118 | 118 | case 'br': |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | if (isset($scriptDataInfo[0][12][13][0][0])) { |
69 | 69 | $category = $this->extractCategory($scriptDataInfo[0][12][13][0]); |
70 | 70 | } |
71 | - elseif (!empty($data[0][12][13][25])){ |
|
71 | + elseif (!empty($data[0][12][13][25])) { |
|
72 | 72 | $genreId = (string) $data[0][12][13][25]; |
73 | - $genreName = ucwords(strtolower(str_replace(['_', 'AND'],[' ', '&'], $genreId))); |
|
73 | + $genreName = ucwords(strtolower(str_replace(['_', 'AND'], [' ', '&'], $genreId))); |
|
74 | 74 | $category = new Category($genreId, $genreName); |
75 | 75 | } |
76 | - else{ |
|
76 | + else { |
|
77 | 77 | $category = null; |
78 | 78 | } |
79 | 79 | $summary = $this->extractSummary($scriptDataInfo); |
@@ -223,8 +223,7 @@ discard block |
||
223 | 223 | LocaleHelper::findPreferredLanguage( |
224 | 224 | $locale, |
225 | 225 | $scriptDataInfo[0][19][1] |
226 | - ) : |
|
227 | - null; |
|
226 | + ) : null; |
|
228 | 227 | } |
229 | 228 | |
230 | 229 | /** |
@@ -260,7 +259,7 @@ discard block |
||
260 | 259 | */ |
261 | 260 | private function extractDeveloper(array $scriptDataInfo): Developer |
262 | 261 | { |
263 | - $developerPage = GPlayApps::GOOGLE_PLAY_URL . $scriptDataInfo[0][12][5][5][4][2]; |
|
262 | + $developerPage = GPlayApps::GOOGLE_PLAY_URL.$scriptDataInfo[0][12][5][5][4][2]; |
|
264 | 263 | $developerId = parse_query(parse_url($developerPage, \PHP_URL_QUERY))[GPlayApps::REQ_PARAM_ID]; |
265 | 264 | $developerName = $scriptDataInfo[0][12][5][1]; |
266 | 265 | $developerEmail = $scriptDataInfo[0][12][5][2][0] ?? null; |
@@ -320,8 +319,7 @@ discard block |
||
320 | 319 | protected function extractPrice(array $scriptDataPrice): ?float |
321 | 320 | { |
322 | 321 | return isset($scriptDataPrice[0][2][0][0][0][1][0][0]) ? |
323 | - (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : |
|
324 | - 0.0; |
|
322 | + (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : 0.0; |
|
325 | 323 | } |
326 | 324 | |
327 | 325 | /** |
@@ -356,7 +354,7 @@ discard block |
||
356 | 354 | private function extractScreenshots(array $scriptDataInfo): array |
357 | 355 | { |
358 | 356 | return !empty($scriptDataInfo[0][12][0]) ? array_map( |
359 | - static function (array $v) { |
|
357 | + static function(array $v) { |
|
360 | 358 | return new GoogleImage($v[3][2]); |
361 | 359 | }, |
362 | 360 | $scriptDataInfo[0][12][0] |
@@ -67,13 +67,11 @@ |
||
67 | 67 | $developer = $this->extractDeveloper($scriptDataInfo); |
68 | 68 | if (isset($scriptDataInfo[0][12][13][0][0])) { |
69 | 69 | $category = $this->extractCategory($scriptDataInfo[0][12][13][0]); |
70 | - } |
|
71 | - elseif (!empty($data[0][12][13][25])){ |
|
70 | + } elseif (!empty($data[0][12][13][25])){ |
|
72 | 71 | $genreId = (string) $data[0][12][13][25]; |
73 | 72 | $genreName = ucwords(strtolower(str_replace(['_', 'AND'],[' ', '&'], $genreId))); |
74 | 73 | $category = new Category($genreId, $genreName); |
75 | - } |
|
76 | - else{ |
|
74 | + } else{ |
|
77 | 75 | $category = null; |
78 | 76 | } |
79 | 77 | $summary = $this->extractSummary($scriptDataInfo); |