Passed
Branch develop (2fd4b5)
by Alexey
03:23
created
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];
40 40
 
41 41
             $reply = self::extractReplyReview($reviewData);
Please login to merge, or discard this patch.
src/Scraper/Extractor/AppsExtractor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     private static function extractDeveloper(array $data): Developer
58 58
     {
59 59
         $developerName = $data[4][0][0][0];
60
-        $developerPage = GPlayApps::GOOGLE_PLAY_URL . $data[4][0][0][1][4][2];
60
+        $developerPage = GPlayApps::GOOGLE_PLAY_URL.$data[4][0][0][1][4][2];
61 61
         $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))[GPlayApps::REQ_PARAM_ID];
62 62
         $developer = new Developer(
63 63
             Developer::newBuilder()
Please login to merge, or discard this patch.
src/Scraper/SuggestScraper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     public function __invoke(RequestInterface $request, ResponseInterface $response)
21 21
     {
22 22
         $json = \GuzzleHttp\json_decode($response->getBody()->getContents(), true);
23
-        return array_map(static function (array $v) {
23
+        return array_map(static function(array $v) {
24 24
             return $v['s'];
25 25
         }, $json);
26 26
     }
Please login to merge, or discard this patch.
src/Model/Developer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,15 +80,15 @@
 block discarded – undo
80 80
         $this->address = $builder->getAddress();
81 81
 
82 82
         if (empty($this->id)) {
83
-            throw new \InvalidArgumentException('Developer id cannot be null or empty. ' .
83
+            throw new \InvalidArgumentException('Developer id cannot be null or empty. '.
84 84
                 'Solution: $developerBuilder->setId(...);');
85 85
         }
86 86
         if (empty($this->url)) {
87
-            throw new \InvalidArgumentException('Developer url cannot be null or empty. ' .
87
+            throw new \InvalidArgumentException('Developer url cannot be null or empty. '.
88 88
                 'Solution: $developerBuilder->setUrl(...);');
89 89
         }
90 90
         if (empty($this->name)) {
91
-            throw new \InvalidArgumentException('Developer name cannot be null or empty. ' .
91
+            throw new \InvalidArgumentException('Developer name cannot be null or empty. '.
92 92
                 'Solution: $developerBuilder->setName(...);');
93 93
         }
94 94
     }
Please login to merge, or discard this patch.
src/Model/GoogleImage.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             }
176 176
             $parts = array_slice($parts, 0, 4);
177 177
             $path = implode('/', $parts);
178
-            $url = $httpComponents['scheme'] . '://' . $httpComponents['host'] . '/' . $path . '/';
178
+            $url = $httpComponents['scheme'].'://'.$httpComponents['host'].'/'.$path.'/';
179 179
             $this->variantOfUrlWithFileName = true;
180 180
         } elseif (($pos = strpos($url, '=')) !== false) {
181 181
             $paramString = substr($url, $pos + 1);
@@ -202,19 +202,19 @@  discard block
 block discarded – undo
202 202
             $command = $param[0]; // 1 char
203 203
             switch ($command) {
204 204
                 case self::PARAM_SIZE:
205
-                    $arg = (int)substr($param, 1);
205
+                    $arg = (int) substr($param, 1);
206 206
                     $this->setSize($arg);
207 207
                     break;
208 208
                 case self::PARAM_WIDTH:
209
-                    $arg = (int)substr($param, 1);
209
+                    $arg = (int) substr($param, 1);
210 210
                     $this->setWidth($arg);
211 211
                     break;
212 212
                 case self::PARAM_HEIGHT:
213
-                    $arg = (int)substr($param, 1);
213
+                    $arg = (int) substr($param, 1);
214 214
                     $this->setHeight($arg);
215 215
                     break;
216 216
                 case self::PARAM_BORDER:
217
-                    $arg = (int)substr($param, 1);
217
+                    $arg = (int) substr($param, 1);
218 218
                     $this->setBorder($arg);
219 219
                     break;
220 220
                 case self::PARAM_SQUARE_CROP:
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
     {
247 247
         $params = [];
248 248
         if ($this->size !== null) {
249
-            $params[] = self::PARAM_SIZE . $this->size;
249
+            $params[] = self::PARAM_SIZE.$this->size;
250 250
         } else {
251 251
             if ($this->width !== null) {
252
-                $params[] = self::PARAM_WIDTH . $this->width;
252
+                $params[] = self::PARAM_WIDTH.$this->width;
253 253
             }
254 254
             if ($this->height !== null) {
255
-                $params[] = self::PARAM_HEIGHT . $this->height;
255
+                $params[] = self::PARAM_HEIGHT.$this->height;
256 256
             }
257 257
         }
258 258
 
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
             if (empty($params)) {
267 267
                 return $this->baseUrl;
268 268
             }
269
-            return $this->baseUrl . implode('-', $params) . '/';
269
+            return $this->baseUrl.implode('-', $params).'/';
270 270
         }
271 271
 
272 272
         if ($this->border !== null) {
273
-            $params[] = self::PARAM_BORDER . $this->border;
273
+            $params[] = self::PARAM_BORDER.$this->border;
274 274
         }
275 275
 
276 276
         if ($this->verticalFlip) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         if (empty($params)) {
285 285
             return $this->baseUrl;
286 286
         }
287
-        return $this->baseUrl . '=' . implode('-', $params);
287
+        return $this->baseUrl.'='.implode('-', $params);
288 288
     }
289 289
 
290 290
     /**
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
      */
307 307
     public function getOriginalSizeUrl(): string
308 308
     {
309
-        $params = [self::PARAM_SIZE . '0'];
309
+        $params = [self::PARAM_SIZE.'0'];
310 310
         if ($this->variantOfUrlWithFileName) {
311
-            return $this->baseUrl . implode('-', $params) . '/';
311
+            return $this->baseUrl.implode('-', $params).'/';
312 312
         }
313
-        return $this->baseUrl . '=' . implode('-', $params);
313
+        return $this->baseUrl.'='.implode('-', $params);
314 314
     }
315 315
 
316 316
     /**
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
         $hashLength = strlen($hash);
330 330
         $parts = max(0, min(6, $parts));
331 331
         if ($parts > 0) {
332
-            $partLength = max(1, min($partLength, (int)($hashLength / $parts)));
332
+            $partLength = max(1, min($partLength, (int) ($hashLength / $parts)));
333 333
             $partsBuild = [];
334 334
             for ($i = 0; $i < $parts; $i++) {
335 335
                 $partsBuild[] = substr($hash, $i * $partLength, $partLength);
336 336
             }
337
-            $hash = implode('/', $partsBuild) . '/' . $hash;
337
+            $hash = implode('/', $partsBuild).'/'.$hash;
338 338
         }
339 339
         return $hash;
340 340
     }
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
             ]);
588 588
 
589 589
             return new ImageInfo($url, $destPath);
590
-        } catch (\Throwable|GuzzleException $e) {
590
+        } catch (\Throwable | GuzzleException $e) {
591 591
             if (is_file($destPath)) {
592 592
                 unlink($destPath);
593 593
             }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
                 RequestOptions::HTTP_ERRORS => true,
627 627
             ]);
628 628
             return $response->getBody()->getContents();
629
-        } catch (\Throwable|GuzzleException $e) {
629
+        } catch (\Throwable | GuzzleException $e) {
630 630
             $ge = new GooglePlayException($e->getMessage(), $e->getCode(), $e);
631 631
             $ge->setUrl($url);
632 632
             throw $ge;
Please login to merge, or discard this patch.
src/Model/AppDetail.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
         if ($otherApp->getIcon()->getOriginalSizeUrl() !== $this->getIcon()->getOriginalSizeUrl()) {
504 504
             return false;
505 505
         }
506
-        $diff = array_udiff($otherApp->screenshots, $this->screenshots, static function (GoogleImage $a, GoogleImage $b) {
506
+        $diff = array_udiff($otherApp->screenshots, $this->screenshots, static function(GoogleImage $a, GoogleImage $b) {
507 507
             return strcmp($a->getOriginalSizeUrl(), $b->getOriginalSizeUrl());
508 508
         });
509 509
         return empty($diff);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         $array['description'] = $this->description;
521 521
         $array['translatedFromLocale'] = $this->translatedFromLocale;
522 522
         $array['cover'] = $this->cover !== null ? $this->cover->getUrl() : null;
523
-        $array['screenshots'] = array_map(static function (GoogleImage $googleImage) {
523
+        $array['screenshots'] = array_map(static function(GoogleImage $googleImage) {
524 524
             return $googleImage->getUrl();
525 525
         }, $this->screenshots);
526 526
         $array['category'] = $this->category->asArray();
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
         $array['updated'] = $this->updated !== null ? $this->updated->format(\DateTimeInterface::RFC3339) : null;
548 548
         $array['updatedTimestamp'] = $this->updated !== null ? $this->updated->getTimestamp() : 0;
549 549
         $array['numberReviews'] = $this->numberReviews;
550
-        $array['reviews'] = array_map(static function (Review $review) {
550
+        $array['reviews'] = array_map(static function(Review $review) {
551 551
             return $review->asArray();
552 552
         }, $this->reviews);
553 553
         return $array;
Please login to merge, or discard this patch.
src/Model/AppId.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getUrl(): string
72 72
     {
73
-        return GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query([
73
+        return GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query([
74 74
                 GPlayApps::REQ_PARAM_ID => $this->id,
75 75
             ]);
76 76
     }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getFullUrl(): string
82 82
     {
83
-        return GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?' . http_build_query([
83
+        return GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?'.http_build_query([
84 84
                 GPlayApps::REQ_PARAM_ID => $this->id,
85 85
                 GPlayApps::REQ_PARAM_LOCALE => $this->locale,
86 86
                 GPlayApps::REQ_PARAM_COUNTRY => $this->country,
Please login to merge, or discard this patch.
src/Model/ImageInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
         $this->url = $url;
49 49
         $imageInfo = getimagesize($filename);
50 50
         if (!$imageInfo) {
51
-            throw new \RuntimeException('Invalid image: ' . $filename);
51
+            throw new \RuntimeException('Invalid image: '.$filename);
52 52
         }
53 53
         $this->filename = $filename;
54 54
         $this->mimeType = $imageInfo['mime'];
Please login to merge, or discard this patch.
src/Util/ScraperUtil.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     {
23 23
         $scripts = [];
24 24
         if (preg_match_all('/>AF_initDataCallback[\s\S]*?<\/script/', $html, $matches)) {
25
-            $scripts = array_reduce($matches[0], static function ($carry, $item) {
25
+            $scripts = array_reduce($matches[0], static function($carry, $item) {
26 26
                 if (
27 27
                     preg_match("/(ds:.*?)'/", $item, $keyMatch) &&
28 28
                     preg_match('/return ([\s\S]*?)}}\);<\//', $item, $valueMatch)
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $doc = new \DOMDocument();
45 45
         $internalErrors = libxml_use_internal_errors(true);
46
-        if (!$doc->loadHTML('<?xml encoding="utf-8"?>' . $html)) {
46
+        if (!$doc->loadHTML('<?xml encoding="utf-8"?>'.$html)) {
47 47
             throw new
48
-            \RuntimeException('error load html: ' . $html);
48
+            \RuntimeException('error load html: '.$html);
49 49
         }
50 50
         libxml_use_internal_errors($internalErrors);
51 51
         return $doc;
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
                 case 'p':
90 90
                 case 'ul':
91 91
                 case 'div':
92
-                    $text = "\n\n" . $text . "\n\n";
92
+                    $text = "\n\n".$text."\n\n";
93 93
                     break;
94 94
                 case 'li':
95
-                    $text = '- ' . $text . "\n";
95
+                    $text = '- '.$text."\n";
96 96
                     break;
97 97
                 case 'br':
98 98
                     $text .= "\n";
Please login to merge, or discard this patch.