@@ -26,7 +26,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -37,8 +37,8 @@ |
||
| 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 && |
@@ -35,10 +35,10 @@ |
||
| 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]; |
@@ -21,8 +21,8 @@ |
||
| 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]); |
@@ -27,10 +27,10 @@ |
||
| 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 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $similarAppsUrl = null; |
| 28 | 28 | foreach ($scriptData as $key => $scriptValue) { |
| 29 | 29 | if (isset($scriptValue[1][1][0][0][3][4][2])) { |
| 30 | - $similarAppsUrl = GPlayApps::GOOGLE_PLAY_URL . $scriptValue[1][1][0][0][3][4][2]; |
|
| 30 | + $similarAppsUrl = GPlayApps::GOOGLE_PLAY_URL.$scriptValue[1][1][0][0][3][4][2]; |
|
| 31 | 31 | break; |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $similarAppsUrl .= |
| 42 | - '&' . GPlayApps::REQ_PARAM_LOCALE . '=' . urlencode($this->locale) . |
|
| 43 | - '&' . GPlayApps::REQ_PARAM_COUNTRY . '=' . urlencode($this->country); |
|
| 42 | + '&'.GPlayApps::REQ_PARAM_LOCALE.'='.urlencode($this->locale). |
|
| 43 | + '&'.GPlayApps::REQ_PARAM_COUNTRY.'='.urlencode($this->country); |
|
| 44 | 44 | |
| 45 | 45 | $requestSimilar = new Request('GET', $similarAppsUrl); |
| 46 | 46 | try { |
@@ -43,10 +43,10 @@ |
||
| 43 | 43 | foreach ($scriptDataInfo[0][1][0][0][0] as $data) { |
| 44 | 44 | $name = $data[2]; |
| 45 | 45 | $appId = $data[12][0]; |
| 46 | - $url = GPlayApps::GOOGLE_PLAY_URL . $data[9][4][2]; |
|
| 46 | + $url = GPlayApps::GOOGLE_PLAY_URL.$data[9][4][2]; |
|
| 47 | 47 | $icon = new GoogleImage($data[1][1][0][3][2]); |
| 48 | 48 | $developerName = $data[4][0][0][0]; |
| 49 | - $developerPage = GPlayApps::GOOGLE_PLAY_URL . $data[4][0][0][1][4][2]; |
|
| 49 | + $developerPage = GPlayApps::GOOGLE_PLAY_URL.$data[4][0][0][1][4][2]; |
|
| 50 | 50 | $developerId = parse_query(parse_url($developerPage, PHP_URL_QUERY))[GPlayApps::REQ_PARAM_APP_ID]; |
| 51 | 51 | $price = $data[7][0][3][2][1][0][2] ?? null; |
| 52 | 52 | $summary = $data[4][1][1][1][1]; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | $parts = array_slice($parts, 0, 4); |
| 162 | 162 | $path = implode('/', $parts); |
| 163 | - $url = $httpComponents['scheme'] . '://' . $httpComponents['host'] . '/' . $path . '/'; |
|
| 163 | + $url = $httpComponents['scheme'].'://'.$httpComponents['host'].'/'.$path.'/'; |
|
| 164 | 164 | $this->variantOfUrlWithFileName = true; |
| 165 | 165 | } elseif (($pos = strpos($url, '=')) !== false) { |
| 166 | 166 | $paramString = substr($url, $pos + 1); |
@@ -188,19 +188,19 @@ discard block |
||
| 188 | 188 | $command = $param[0]; // 1 char |
| 189 | 189 | switch ($command) { |
| 190 | 190 | case self::PARAM_SIZE: |
| 191 | - $arg = (int)substr($param, 1); |
|
| 191 | + $arg = (int) substr($param, 1); |
|
| 192 | 192 | $this->setSize($arg); |
| 193 | 193 | break; |
| 194 | 194 | case self::PARAM_WIDTH: |
| 195 | - $arg = (int)substr($param, 1); |
|
| 195 | + $arg = (int) substr($param, 1); |
|
| 196 | 196 | $this->setWidth($arg); |
| 197 | 197 | break; |
| 198 | 198 | case self::PARAM_HEIGHT: |
| 199 | - $arg = (int)substr($param, 1); |
|
| 199 | + $arg = (int) substr($param, 1); |
|
| 200 | 200 | $this->setHeight($arg); |
| 201 | 201 | break; |
| 202 | 202 | case self::PARAM_BORDER: |
| 203 | - $arg = (int)substr($param, 1); |
|
| 203 | + $arg = (int) substr($param, 1); |
|
| 204 | 204 | $this->setBorder($arg); |
| 205 | 205 | break; |
| 206 | 206 | case self::PARAM_SQUARE_CROP: |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | { |
| 231 | 231 | $params = []; |
| 232 | 232 | if ($this->size !== null) { |
| 233 | - $params[] = self::PARAM_SIZE . $this->size; |
|
| 233 | + $params[] = self::PARAM_SIZE.$this->size; |
|
| 234 | 234 | } else { |
| 235 | 235 | if ($this->width !== null) { |
| 236 | - $params[] = self::PARAM_WIDTH . $this->width; |
|
| 236 | + $params[] = self::PARAM_WIDTH.$this->width; |
|
| 237 | 237 | } |
| 238 | 238 | if ($this->height !== null) { |
| 239 | - $params[] = self::PARAM_HEIGHT . $this->height; |
|
| 239 | + $params[] = self::PARAM_HEIGHT.$this->height; |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | if (empty($params)) { |
| 256 | 256 | return $this->url; |
| 257 | 257 | } |
| 258 | - return $this->url . implode('-', $params) . '/'; |
|
| 258 | + return $this->url.implode('-', $params).'/'; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | if ($this->border !== null) { |
| 262 | - $params[] = self::PARAM_BORDER . $this->border; |
|
| 262 | + $params[] = self::PARAM_BORDER.$this->border; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if ($this->verticalFlip) { |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | if (empty($params)) { |
| 274 | 274 | return $this->url; |
| 275 | 275 | } |
| 276 | - return $this->url . '=' . implode('-', $params); |
|
| 276 | + return $this->url.'='.implode('-', $params); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -283,11 +283,11 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function getBestSizeUrl(): string |
| 285 | 285 | { |
| 286 | - $params = [self::PARAM_SIZE . '0']; |
|
| 286 | + $params = [self::PARAM_SIZE.'0']; |
|
| 287 | 287 | if ($this->variantOfUrlWithFileName) { |
| 288 | - return $this->url . implode('-', $params) . '/'; |
|
| 288 | + return $this->url.implode('-', $params).'/'; |
|
| 289 | 289 | } |
| 290 | - return $this->url . '=' . implode('-', $params); |
|
| 290 | + return $this->url.'='.implode('-', $params); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | $hashLength = strlen($hash); |
| 306 | 306 | $parts = max(1, min(6, $parts)); |
| 307 | 307 | if ($parts > 1) { |
| 308 | - $partLength = max(1, min($partLength, (int)($hashLength / $parts))); |
|
| 308 | + $partLength = max(1, min($partLength, (int) ($hashLength / $parts))); |
|
| 309 | 309 | $partsBuild = []; |
| 310 | 310 | for ($i = 0; $i < $parts; $i++) { |
| 311 | 311 | $partsBuild[] = substr($hash, $i * $partLength, $partLength); |
| 312 | 312 | } |
| 313 | - $hash = implode('/', $partsBuild) . '/' . $hash; |
|
| 313 | + $hash = implode('/', $partsBuild).'/'.$hash; |
|
| 314 | 314 | } |
| 315 | 315 | return $hash; |
| 316 | 316 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | ]); |
| 529 | 529 | |
| 530 | 530 | return new ImageInfo($url, $destPath); |
| 531 | - } catch (\Throwable|GuzzleException $e) { |
|
| 531 | + } catch (\Throwable | GuzzleException $e) { |
|
| 532 | 532 | if (is_file($destPath)) { |
| 533 | 533 | unlink($destPath); |
| 534 | 534 | } |
@@ -173,7 +173,7 @@ |
||
| 173 | 173 | public function setId(string $id): AppBuilder |
| 174 | 174 | { |
| 175 | 175 | $this->id = $id; |
| 176 | - $this->url = GPlayApps::GOOGLE_PLAY_APPS_URL . '/details?id=' . $id; |
|
| 176 | + $this->url = GPlayApps::GOOGLE_PLAY_APPS_URL.'/details?id='.$id; |
|
| 177 | 177 | return $this; |
| 178 | 178 | } |
| 179 | 179 | |