Passed
Branch develop (bc8038)
by Alexey
02:01
created
src/Scraper/AppDetailScraper.php 1 patch
Spacing   +17 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $query = parse_query($request->getUri()->getQuery());
36 36
         $appId = $query[GPlayApps::REQ_PARAM_APP_ID];
37 37
         $locale = $query[GPlayApps::REQ_PARAM_LOCALE] ?? GPlayApps::DEFAULT_LOCALE;
38
-        $url = GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query([
38
+        $url = GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query([
39 39
                 GPlayApps::REQ_PARAM_APP_ID => $appId,
40 40
             ]);
41 41
 
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
             ScraperUtil::html2text($scriptDataInfo[0][10][1][1]);
87 87
 
88 88
         $installs = $scriptDataInfo[0][12][9][2] ?? 0;
89
-        $score = (float)($scriptDataRating[0][6][0][1] ?? 0);
90
-        $numberVoters = (int)($scriptDataRating[0][6][2][1] ?? 0);
91
-        $reviewsCount = (int)($scriptDataRating[0][6][3][1] ?? 0);
89
+        $score = (float) ($scriptDataRating[0][6][0][1] ?? 0);
90
+        $numberVoters = (int) ($scriptDataRating[0][6][2][1] ?? 0);
91
+        $reviewsCount = (int) ($scriptDataRating[0][6][3][1] ?? 0);
92 92
         $histogram = $scriptDataRating[0][6][1] ?? null;
93 93
 
94 94
         $histogramRating = new HistogramRating(
@@ -100,12 +100,11 @@  discard block
 block discarded – undo
100 100
         );
101 101
 
102 102
         $price = isset($scriptDataPrice[0][2][0][0][0][1][0][0]) ?
103
-            (float)($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) :
104
-            0;
103
+            (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : 0;
105 104
         $currency = $scriptDataPrice[0][2][0][0][0][1][0][1];
106 105
         $priceText = $scriptDataPrice[0][2][0][0][0][1][0][2] ?: 'Free';
107 106
         $offersIAPCost = $scriptDataInfo[0][12][12][0] ?? null;
108
-        $adSupported = (bool)$scriptDataInfo[0][12][14][0];
107
+        $adSupported = (bool) $scriptDataInfo[0][12][14][0];
109 108
 
110 109
         [$size, $appVersion, $androidVersion] = $scriptDataVersion;
111 110
         if (LocaleHelper::isDependOnDevice($locale, $size)) {
@@ -144,7 +143,7 @@  discard block
 block discarded – undo
144 143
         }
145 144
         try {
146 145
             $updated = !empty($scriptDataInfo[0][12][8][0]) ?
147
-                new \DateTimeImmutable('@' . $scriptDataInfo[0][12][8][0])
146
+                new \DateTimeImmutable('@'.$scriptDataInfo[0][12][8][0])
148 147
                 : null;
149 148
         } catch (\Exception $e) {
150 149
             $updated = null;
@@ -216,7 +215,7 @@  discard block
 block discarded – undo
216 215
      */
217 216
     private function extractDeveloper(array $scriptDataInfo): Developer
218 217
     {
219
-        $developerPage = GPlayApps::GOOGLE_PLAY_URL . $scriptDataInfo[0][12][5][5][4][2];
218
+        $developerPage = GPlayApps::GOOGLE_PLAY_URL.$scriptDataInfo[0][12][5][5][4][2];
220 219
         $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))['id'];
221 220
         $developerName = $scriptDataInfo[0][12][5][1];
222 221
         $developerEmail = $scriptDataInfo[0][12][5][2][0];
@@ -242,8 +241,8 @@  discard block
 block discarded – undo
242 241
     private function extractCategory(array $data): ?Category
243 242
     {
244 243
         if (isset($data[0]) && $data[0] !== null && $data[2] !== null) {
245
-            $genreId = (string)$data[2];
246
-            $genreName = (string)$data[0];
244
+            $genreId = (string) $data[2];
245
+            $genreName = (string) $data[0];
247 246
             return new Category($genreId, $genreName);
248 247
         }
249 248
         return null;
@@ -255,7 +254,7 @@  discard block
 block discarded – undo
255 254
      */
256 255
     private function extractScreenshots(array $scriptDataInfo): array
257 256
     {
258
-        return !empty($scriptDataInfo[0][12][0]) ? array_map(static function (array $v) {
257
+        return !empty($scriptDataInfo[0][12][0]) ? array_map(static function(array $v) {
259 258
             return new GoogleImage($v[3][2]);
260 259
         }, $scriptDataInfo[0][12][0]) : [];
261 260
     }
@@ -271,8 +270,8 @@  discard block
 block discarded – undo
271 270
             $scriptDataInfo[0][12][3][0][3][2] !== null &&
272 271
             $scriptDataInfo[0][12][3][1][3][2] !== null
273 272
         ) {
274
-            $videoThumb = (string)$scriptDataInfo[0][12][3][1][3][2];
275
-            $videoUrl = (string)$scriptDataInfo[0][12][3][0][3][2];
273
+            $videoThumb = (string) $scriptDataInfo[0][12][3][1][3][2];
274
+            $videoUrl = (string) $scriptDataInfo[0][12][3][0][3][2];
276 275
 
277 276
             return new Video($videoThumb, $videoUrl);
278 277
         }
@@ -295,25 +294,25 @@  discard block
 block discarded – undo
295 294
         for ($i = 0; $i < $count; $i++) {
296 295
             $reviewData = $scriptDataReviews[0][$i];
297 296
             $reviewId = $reviewData[0];
298
-            $reviewUrl = $appUrl . '&reviewId=' . urlencode($reviewId);
297
+            $reviewUrl = $appUrl.'&reviewId='.urlencode($reviewId);
299 298
             $userName = $reviewData[1][0];
300 299
             $avatar = new GoogleImage($reviewData[1][1][3][2]);
301 300
             $date = null;
302 301
             if (isset($reviewData[5][0])) {
303 302
                 try {
304
-                    $date = new \DateTimeImmutable('@' . $reviewData[5][0]);
303
+                    $date = new \DateTimeImmutable('@'.$reviewData[5][0]);
305 304
                 } catch (\Exception $e) {
306 305
                 }
307 306
             }
308 307
             $score = $reviewData[2] ?? 0;
309
-            $text = (string)($reviewData[4] ?? '');
308
+            $text = (string) ($reviewData[4] ?? '');
310 309
             $likeCount = $reviewData[6];
311 310
 
312 311
             $reply = null;
313 312
             if (isset($reviewData[7][1])) {
314 313
                 $replyText = $reviewData[7][1];
315 314
                 try {
316
-                    $replyDate = new \DateTimeImmutable('@' . $reviewData[7][2][0]);
315
+                    $replyDate = new \DateTimeImmutable('@'.$reviewData[7][2][0]);
317 316
                     $reply = new ReplyReview(
318 317
                         $replyDate,
319 318
                         $replyText
Please login to merge, or discard this patch.