Passed
Branch develop (29ed49)
by Alexey
01:58
created
src/Scraper/FindSimilarAppsUrlScraper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@
 block discarded – undo
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
             }
53 53
         }
54 54
         return null;
Please login to merge, or discard this patch.
src/Scraper/AppDetailScraper.php 1 patch
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $summary = $this->extractSummary($scriptDataInfo);
130 130
         $installs = $scriptDataInfo[0][12][9][2] ?? 0;
131 131
         $offersIAPCost = $scriptDataInfo[0][12][12][0] ?? null;
132
-        $containsAds = (bool)$scriptDataInfo[0][12][14][0];
132
+        $containsAds = (bool) $scriptDataInfo[0][12][14][0];
133 133
         $editorsChoice = !empty($scriptDataInfo[0][12][15][1][1]);
134 134
         $privacyPoliceUrl = $scriptDataInfo[0][12][7][2] ?? '';
135 135
         $categoryFamily = $this->extractCategory($scriptDataInfo[0][12][13][1] ?? []);
@@ -193,8 +193,7 @@  discard block
 block discarded – undo
193 193
             LocaleHelper::findPreferredLanguage(
194 194
                 $locale,
195 195
                 $scriptDataInfo[0][19][1]
196
-            ) :
197
-            null;
196
+            ) : null;
198 197
     }
199 198
 
200 199
     /**
@@ -203,7 +202,7 @@  discard block
 block discarded – undo
203 202
      */
204 203
     private function extractDeveloper(array $scriptDataInfo): Developer
205 204
     {
206
-        $developerPage = GPlayApps::GOOGLE_PLAY_URL . $scriptDataInfo[0][12][5][5][4][2];
205
+        $developerPage = GPlayApps::GOOGLE_PLAY_URL.$scriptDataInfo[0][12][5][5][4][2];
207 206
         $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))[GPlayApps::REQ_PARAM_ID];
208 207
         $developerName = $scriptDataInfo[0][12][5][1];
209 208
         $developerEmail = $scriptDataInfo[0][12][5][2][0];
@@ -229,8 +228,8 @@  discard block
 block discarded – undo
229 228
     private function extractCategory(array $data): ?Category
230 229
     {
231 230
         if (isset($data[0]) && $data[0] !== null && $data[2] !== null) {
232
-            $genreId = (string)$data[2];
233
-            $genreName = (string)$data[0];
231
+            $genreId = (string) $data[2];
232
+            $genreName = (string) $data[0];
234 233
             return new Category($genreId, $genreName);
235 234
         }
236 235
         return null;
@@ -275,7 +274,7 @@  discard block
 block discarded – undo
275 274
      */
276 275
     private function extractScreenshots(array $scriptDataInfo): array
277 276
     {
278
-        return !empty($scriptDataInfo[0][12][0]) ? array_map(static function (array $v) {
277
+        return !empty($scriptDataInfo[0][12][0]) ? array_map(static function(array $v) {
279 278
             return new GoogleImage($v[3][2]);
280 279
         }, $scriptDataInfo[0][12][0]) : [];
281 280
     }
@@ -291,8 +290,8 @@  discard block
 block discarded – undo
291 290
             $scriptDataInfo[0][12][3][0][3][2] !== null &&
292 291
             $scriptDataInfo[0][12][3][1][3][2] !== null
293 292
         ) {
294
-            $videoThumb = (string)$scriptDataInfo[0][12][3][1][3][2];
295
-            $videoUrl = (string)$scriptDataInfo[0][12][3][0][3][2];
293
+            $videoThumb = (string) $scriptDataInfo[0][12][3][1][3][2];
294
+            $videoUrl = (string) $scriptDataInfo[0][12][3][0][3][2];
296 295
 
297 296
             return new Video($videoThumb, $videoUrl);
298 297
         }
@@ -341,9 +340,9 @@  discard block
 block discarded – undo
341 340
      */
342 341
     private function handlerDataRating(AppBuilder $appBuilder, array $scriptDataRating): void
343 342
     {
344
-        $score = (float)($scriptDataRating[0][6][0][1] ?? 0);
345
-        $numberVoters = (int)($scriptDataRating[0][6][2][1] ?? 0);
346
-        $numberReviews = (int)($scriptDataRating[0][6][3][1] ?? 0);
343
+        $score = (float) ($scriptDataRating[0][6][0][1] ?? 0);
344
+        $numberVoters = (int) ($scriptDataRating[0][6][2][1] ?? 0);
345
+        $numberReviews = (int) ($scriptDataRating[0][6][3][1] ?? 0);
347 346
         $histogramRating = $this->extractHistogramRating($scriptDataRating);
348 347
 
349 348
         $appBuilder
@@ -392,8 +391,7 @@  discard block
 block discarded – undo
392 391
     private function extractPrice(array $scriptDataPrice): ?float
393 392
     {
394 393
         return isset($scriptDataPrice[0][2][0][0][0][1][0][0]) ?
395
-            (float)($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) :
396
-            0.0;
394
+            (float) ($scriptDataPrice[0][2][0][0][0][1][0][0] / 1000000) : 0.0;
397 395
     }
398 396
 
399 397
     /**
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
@@ -33,8 +33,8 @@
 block discarded – undo
33 33
     {
34 34
         $dataCategories = $this->getDataScraper($request, $response);
35 35
 
36
-        $parseCategories = static function (array $items) use (&$parseCategories) : array {
37
-            return array_reduce($items, static function ($results, $item) use (&$parseCategories) {
36
+        $parseCategories = static function(array $items) use (&$parseCategories) : array {
37
+            return array_reduce($items, static function($results, $item) use (&$parseCategories) {
38 38
                 if (is_array($item)) {
39 39
                     if (
40 40
                         count($item) === 6 &&
Please login to merge, or discard this patch.
src/Scraper/DeveloperInfoScraper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         $query = parse_query($request->getUri()->getQuery());
36 36
 
37 37
         $developerId = $query[GPlayApps::REQ_PARAM_ID];
38
-        $url = (string)$request->getUri()
38
+        $url = (string) $request->getUri()
39 39
             ->withQuery(http_build_query([GPlayApps::REQ_PARAM_ID => $developerId]));
40 40
 
41 41
         $scriptDataInfo = $this->getScriptDataInfo($request, $response);
Please login to merge, or discard this patch.
src/Scraper/Extractor/ReviewsExtractor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
30 30
         $reviews = [];
31 31
         foreach ($data as $reviewData) {
32 32
             $reviewId = $reviewData[0];
33
-            $reviewUrl = $requestApp->getUrl() . '&reviewId=' . urlencode($reviewId);
33
+            $reviewUrl = $requestApp->getUrl().'&reviewId='.urlencode($reviewId);
34 34
             $userName = $reviewData[1][0];
35 35
             $avatar = (new GoogleImage($reviewData[1][1][3][2]))->setSize(64);
36 36
             $date = DateStringFormatter::unixTimeToDateTime($reviewData[5][0]);
37 37
             $score = $reviewData[2] ?? 0;
38
-            $text = (string)($reviewData[4] ?? '');
38
+            $text = (string) ($reviewData[4] ?? '');
39 39
             $likeCount = $reviewData[6] ?? 0;
40 40
 
41 41
             $reply = self::extractReplyReview($reviewData);
Please login to merge, or discard this patch.