Passed
Branch develop (610403)
by Alexey
02:26
created
src/Scraper/AppDetailScraper.php 1 patch
Spacing   +20 added lines, -23 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
         $urlComponents = parse_url($url);
38 38
         $query = parse_query($urlComponents['query']);
39 39
         $appId = $query[GPlayApps::REQ_PARAM_APP_ID];
40
-        $url = $urlComponents['scheme'] . '://'
40
+        $url = $urlComponents['scheme'].'://'
41 41
             . $urlComponents['host']
42 42
             . $urlComponents['path']
43
-            . '?' . http_build_query([GPlayApps::REQ_PARAM_APP_ID => $appId]);
43
+            . '?'.http_build_query([GPlayApps::REQ_PARAM_APP_ID => $appId]);
44 44
         $locale = $query[GPlayApps::REQ_PARAM_LOCALE] ?? GPlayApps::DEFAULT_LOCALE;
45 45
 
46 46
         $scriptData = ScraperUtil::extractScriptData($response->getBody()->getContents());
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $descriptionHTML = $scriptDataInfo[0][10][0][1];
83 83
         $description = ScraperUtil::html2text($descriptionHTML);
84 84
 
85
-        $developerPage = GPlayApps::GOOGLE_PLAY_URL . $scriptDataInfo[0][12][5][5][4][2];
85
+        $developerPage = GPlayApps::GOOGLE_PLAY_URL.$scriptDataInfo[0][12][5][5][4][2];
86 86
         $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))['id'];
87 87
         $developerName = $scriptDataInfo[0][12][5][1];
88 88
         $developerEmail = $scriptDataInfo[0][12][5][2][0];
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
             ScraperUtil::html2text($scriptDataInfo[0][10][1][1]);
99 99
 
100 100
         $installs = $scriptDataInfo[0][12][9][2] ?? 0;
101
-        $score = (float)($scriptDataRating[0][6][0][1] ?? 0);
102
-        $numberVoters = (int)($scriptDataRating[0][6][2][1] ?? 0);
103
-        $reviewsCount = (int)($scriptDataRating[0][6][3][1] ?? 0);
101
+        $score = (float) ($scriptDataRating[0][6][0][1] ?? 0);
102
+        $numberVoters = (int) ($scriptDataRating[0][6][2][1] ?? 0);
103
+        $reviewsCount = (int) ($scriptDataRating[0][6][3][1] ?? 0);
104 104
         $histogram = $scriptDataRating[0][6][1] ?? null;
105 105
 
106 106
         $histogramRating = new HistogramRating(
@@ -112,12 +112,11 @@  discard block
 block discarded – undo
112 112
         );
113 113
 
114 114
         $price = isset($scriptDataPrice[0][2][0][0][0][1][0][0]) ?
115
-            (float)($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) :
116
-            0;
115
+            (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : 0;
117 116
         $currency = $scriptDataPrice[0][2][0][0][0][1][0][1];
118 117
         $priceText = $scriptDataPrice[0][2][0][0][0][1][0][2] ?: 'Free';
119 118
         $offersIAPCost = $scriptDataInfo[0][12][12][0] ?? null;
120
-        $adSupported = (bool)$scriptDataInfo[0][12][14][0];
119
+        $adSupported = (bool) $scriptDataInfo[0][12][14][0];
121 120
 
122 121
         [$size, $appVersion, $androidVersion] = $scriptDataVersion;
123 122
         if (LocaleHelper::isDependOnDevice($locale, $size)) {
@@ -143,8 +142,8 @@  discard block
 block discarded – undo
143 142
             $scriptDataInfo[0][12][13][1][0] !== null &&
144 143
             $scriptDataInfo[0][12][13][1][2] !== null
145 144
         ) {
146
-            $familyGenreId = (string)$scriptDataInfo[0][12][13][1][2];
147
-            $familyGenreName = (string)$scriptDataInfo[0][12][13][1][0];
145
+            $familyGenreId = (string) $scriptDataInfo[0][12][13][1][2];
146
+            $familyGenreName = (string) $scriptDataInfo[0][12][13][1][0];
148 147
         }
149 148
 
150 149
         $icon = empty($scriptDataInfo[0][12][1][3][2]) ?
@@ -155,7 +154,7 @@  discard block
 block discarded – undo
155 154
             null :
156 155
             new GoogleImage($scriptDataInfo[0][12][2][3][2]);
157 156
 
158
-        $screenshots = !empty($scriptDataInfo[0][12][0]) ? array_map(static function (array $v) {
157
+        $screenshots = !empty($scriptDataInfo[0][12][0]) ? array_map(static function(array $v) {
159 158
             return new GoogleImage($v[3][2]);
160 159
         }, $scriptDataInfo[0][12][0]) : [];
161 160
 
@@ -166,8 +165,8 @@  discard block
 block discarded – undo
166 165
             $scriptDataInfo[0][12][3][0][3][2] !== null &&
167 166
             $scriptDataInfo[0][12][3][1][3][2] !== null
168 167
         ) {
169
-            $videoThumb = (string)$scriptDataInfo[0][12][3][1][3][2];
170
-            $videoUrl = (string)$scriptDataInfo[0][12][3][0][3][2];
168
+            $videoThumb = (string) $scriptDataInfo[0][12][3][1][3][2];
169
+            $videoUrl = (string) $scriptDataInfo[0][12][3][0][3][2];
171 170
         }
172 171
 
173 172
         $contentRating = $scriptDataInfo[0][12][4][0];
@@ -177,7 +176,7 @@  discard block
 block discarded – undo
177 176
         }
178 177
         try {
179 178
             $updated = !empty($scriptDataInfo[0][12][8][0]) ?
180
-                new \DateTimeImmutable('@' . $scriptDataInfo[0][12][8][0])
179
+                new \DateTimeImmutable('@'.$scriptDataInfo[0][12][8][0])
181 180
                 : null;
182 181
         } catch (\Exception $e) {
183 182
             $updated = null;
@@ -224,13 +223,11 @@  discard block
 block discarded – undo
224 223
             ))
225 224
             ->setCategoryFamily(
226 225
                 $familyGenreId !== null && $familyGenreName !== null ?
227
-                    new Category($familyGenreId, $familyGenreName) :
228
-                    null
226
+                    new Category($familyGenreId, $familyGenreName) : null
229 227
             )
230 228
             ->setVideo(
231 229
                 $videoThumb !== null && $videoUrl !== null ?
232
-                    new Video($videoThumb, $videoUrl) :
233
-                    null
230
+                    new Video($videoThumb, $videoUrl) : null
234 231
             )
235 232
             ->setRecentChanges($recentChanges)
236 233
             ->setEditorsChoice($editorsChoice)
@@ -277,26 +274,26 @@  discard block
 block discarded – undo
277 274
         for ($i = 0; $i < $count; $i++) {
278 275
             $reviewData = $scriptDataReviews[0][$i];
279 276
             $reviewId = $reviewData[0];
280
-            $reviewUrl = $appUrl . '&reviewId=' . urlencode($reviewId);
277
+            $reviewUrl = $appUrl.'&reviewId='.urlencode($reviewId);
281 278
             $userName = $reviewData[1][0];
282 279
             $avatar = new GoogleImage($reviewData[1][1][3][2]);
283 280
             $date = null;
284 281
             if (isset($reviewData[5][0])) {
285 282
                 try {
286
-                    $date = new \DateTimeImmutable('@' . $reviewData[5][0]);
283
+                    $date = new \DateTimeImmutable('@'.$reviewData[5][0]);
287 284
                 } catch (\Exception $e) {
288 285
                     $date = null;
289 286
                 }
290 287
             }
291 288
             $score = $reviewData[2] ?? 0;
292
-            $text = (string)($reviewData[4] ?? '');
289
+            $text = (string) ($reviewData[4] ?? '');
293 290
             $likeCount = $reviewData[6];
294 291
 
295 292
             $reply = null;
296 293
             if (isset($reviewData[7][1])) {
297 294
                 $replyText = $reviewData[7][1];
298 295
                 try {
299
-                    $replyDate = new \DateTimeImmutable('@' . $reviewData[7][2][0]);
296
+                    $replyDate = new \DateTimeImmutable('@'.$reviewData[7][2][0]);
300 297
                     $reply = new ReplyReview(
301 298
                         $replyDate,
302 299
                         $replyText
Please login to merge, or discard this patch.
src/Scraper/AppReviewScraper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
         $doc = new \DOMDocument();
31 31
         $internalErrors = libxml_use_internal_errors(true);
32
-        if (!$doc->loadHTML('<?xml encoding="utf-8" ?>' . $html)) {
32
+        if (!$doc->loadHTML('<?xml encoding="utf-8" ?>'.$html)) {
33 33
             throw new \RuntimeException('error load html');
34 34
         }
35 35
         libxml_use_internal_errors($internalErrors);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                     if ($reviewUrlNode === null) {
59 59
                         continue;
60 60
                     }
61
-                    $reviewUrl = GPlayApps::GOOGLE_PLAY_URL . $reviewUrlNode->item(0)->textContent;
61
+                    $reviewUrl = GPlayApps::GOOGLE_PLAY_URL.$reviewUrlNode->item(0)->textContent;
62 62
                 }
63 63
                 // user name
64 64
                 {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 if ($ratingStyleAttr !== null) {
99 99
                     $ratingStyle = $ratingStyleAttr->textContent;
100 100
                     if (preg_match('/([\d]+)%/', $ratingStyle, $match)) {
101
-                        $score = (int)($match[1] * 0.05); // percent * 5 star
101
+                        $score = (int) ($match[1] * 0.05); // percent * 5 star
102 102
                     }
103 103
                 }
104 104
             }
Please login to merge, or discard this patch.
src/Scraper/PlayStoreUiPagesScraper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,13 +71,13 @@
 block discarded – undo
71 71
                 'soc-platform' => 1,
72 72
                 'soc-device' => 1,
73 73
             ];
74
-            $playStoreUiUrl = GPlayApps::GOOGLE_PLAY_URL . '/_/PlayStoreUi/data/batchexecute?' . http_build_query($params);
74
+            $playStoreUiUrl = GPlayApps::GOOGLE_PLAY_URL.'/_/PlayStoreUi/data/batchexecute?'.http_build_query($params);
75 75
 
76 76
             $savedApps = [$apps];
77 77
             while ($countApps < $this->limit && $scraper->hasNextToken()) {
78 78
                 $limit = min(100, $this->limit - $countApps);
79 79
                 $body = [
80
-                    'f.req' => '[[["' . self::RPC_ID . '","[[null,[[10,[10,' . $limit . ']],true,null,[1]],null,\\"' . $scraper->getToken() . '\\"]]",null,"generic"]]]',
80
+                    'f.req' => '[[["'.self::RPC_ID.'","[[null,[[10,[10,'.$limit.']],true,null,[1]],null,\\"'.$scraper->getToken().'\\"]]",null,"generic"]]]',
81 81
                 ];
82 82
 
83 83
                 /**
Please login to merge, or discard this patch.
src/Scraper/DeveloperAppsScraper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
         if ($developerAppsUrl === null) {
41 41
             return [];
42 42
         }
43
-        $developerAppsUrl = GPlayApps::GOOGLE_PLAY_URL . $developerAppsUrl;
43
+        $developerAppsUrl = GPlayApps::GOOGLE_PLAY_URL.$developerAppsUrl;
44 44
 
45 45
         $developerAppsUrl .=
46
-            '&' . GPlayApps::REQ_PARAM_LOCALE . '=' . urlencode($this->locale) .
47
-            '&' . GPlayApps::REQ_PARAM_COUNTRY . '=' . urlencode($this->country);
46
+            '&'.GPlayApps::REQ_PARAM_LOCALE.'='.urlencode($this->locale).
47
+            '&'.GPlayApps::REQ_PARAM_COUNTRY.'='.urlencode($this->country);
48 48
 
49 49
         $requestSimilar = new Request('GET', $developerAppsUrl);
50 50
         try {
Please login to merge, or discard this patch.
src/Scraper/ListScraper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $doc = new \DOMDocument();
28 28
         $internalErrors = libxml_use_internal_errors(true);
29
-        if (!$doc->loadHTML('<?xml encoding="utf-8" ?>' . $response->getBody()->getContents())) {
29
+        if (!$doc->loadHTML('<?xml encoding="utf-8" ?>'.$response->getBody()->getContents())) {
30 30
             throw new \RuntimeException('error load html');
31 31
         }
32 32
         libxml_use_internal_errors($internalErrors);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                     throw (new GooglePlayException('Error parse app list'))
50 50
                         ->setUrl($request->getUri()->__toString());
51 51
                 }
52
-                $url = GPlayApps::GOOGLE_PLAY_URL . $nodeTitle->attributes->getNamedItem('href')->textContent;
52
+                $url = GPlayApps::GOOGLE_PLAY_URL.$nodeTitle->attributes->getNamedItem('href')->textContent;
53 53
                 $name = trim($nodeTitle->attributes->getNamedItem('title')->textContent);
54 54
             }
55 55
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                         ->setUrl($request->getUri()->__toString());
69 69
                 }
70 70
                 $developerName = trim($developerNode->textContent);
71
-                $developerUrl = GPlayApps::GOOGLE_PLAY_URL . $developerNode->attributes->getNamedItem('href')->textContent;
71
+                $developerUrl = GPlayApps::GOOGLE_PLAY_URL.$developerNode->attributes->getNamedItem('href')->textContent;
72 72
                 $developerId = parse_query(parse_url($developerUrl, PHP_URL_QUERY))[GPlayApps::REQ_PARAM_APP_ID];
73 73
             }
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                     throw (new GooglePlayException('Error parse app list icon node'))
79 79
                         ->setUrl($request->getUri()->__toString());
80 80
                 }
81
-                $icon = new GoogleImage('https:' . $iconNode->textContent);
81
+                $icon = new GoogleImage('https:'.$iconNode->textContent);
82 82
                 $icon->reset();
83 83
             }
84 84
 
Please login to merge, or discard this patch.
src/Scraper/CategoriesScraper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@
 block discarded – undo
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 &&
Please login to merge, or discard this patch.
src/Scraper/PlayStoreUiScraper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@
 block discarded – undo
35 35
         foreach ($json[0][0][0] as $data) {
36 36
             $name = $data[2];
37 37
             $appId = $data[12][0];
38
-            $url = GPlayApps::GOOGLE_PLAY_URL . $data[9][4][2];
38
+            $url = GPlayApps::GOOGLE_PLAY_URL.$data[9][4][2];
39 39
             $icon = new GoogleImage($data[1][1][0][3][2]);
40 40
             $developerName = $data[4][0][0][0];
41
-            $developerPage = GPlayApps::GOOGLE_PLAY_URL . $data[4][0][0][1][4][2];
41
+            $developerPage = GPlayApps::GOOGLE_PLAY_URL.$data[4][0][0][1][4][2];
42 42
             $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))['id'];
43 43
             $price = $data[7][0][3][2][1][0][2];
44 44
             $summary = $data[4][1][1][1][1];
Please login to merge, or discard this patch.
src/Scraper/PermissionScraper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
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]);
Please login to merge, or discard this patch.
src/Scraper/DeveloperPageScraper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@
 block discarded – undo
27 27
         $urlComponents = parse_url($url);
28 28
         $query = parse_query($urlComponents['query']);
29 29
         $developerId = $query[GPlayApps::REQ_PARAM_APP_ID];
30
-        $url = $urlComponents['scheme'] . '://'
30
+        $url = $urlComponents['scheme'].'://'
31 31
             . $urlComponents['host']
32 32
             . $urlComponents['path']
33
-            . '?' . http_build_query([GPlayApps::REQ_PARAM_APP_ID => $developerId]);
33
+            . '?'.http_build_query([GPlayApps::REQ_PARAM_APP_ID => $developerId]);
34 34
 
35 35
         $scriptData = ScraperUtil::extractScriptData($response->getBody()->getContents());
36 36
 
Please login to merge, or discard this patch.