@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | $enc_url = \preg_replace_callback( |
| 34 | 34 | $pattern, |
| 35 | - function ($matches) { |
|
| 35 | + function($matches) { |
|
| 36 | 36 | $encoded = \urlencode($matches[3]); |
| 37 | 37 | |
| 38 | 38 | return \sprintf('%s%s%s', $matches[1], $matches[2], $encoded); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Pdp; |
| 6 | 6 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * PHP Domain Parser: Public Suffix List based URL parsing. |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * PHP Domain Parser: Public Suffix List based URL parsing. |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | if (\preg_match(self::SCHEME_PATTERN, $url) === 0) { |
| 90 | 90 | // Wacky scheme required to overcome parse_url behavior in PHP |
| 91 | 91 | // See https://github.com/jeremykendall/php-domain-parser/issues/49 |
| 92 | - $url = 'php-hack://' . \preg_replace('#^//#', '', $url, 1); |
|
| 92 | + $url = 'php-hack://'.\preg_replace('#^//#', '', $url, 1); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $parts = pdp_parse_url($url); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 106 | - $elem = (array)$parts + $elem; |
|
| 106 | + $elem = (array) $parts + $elem; |
|
| 107 | 107 | |
| 108 | 108 | $host = $this->parseHost($parts['host']); |
| 109 | 109 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * PHP Domain Parser: Public Suffix List based URL parsing. |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | if (null === $cacheDir) { |
| 69 | 69 | $cacheDir = realpath( |
| 70 | - dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'data' |
|
| 70 | + dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'data' |
|
| 71 | 71 | ); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public function refreshPublicSuffixList() |
| 82 | 82 | { |
| 83 | 83 | $this->fetchListFromSource(); |
| 84 | - $cacheFile = $this->cacheDir . '/' . self::PDP_PSL_TEXT_FILE; |
|
| 84 | + $cacheFile = $this->cacheDir.'/'.self::PDP_PSL_TEXT_FILE; |
|
| 85 | 85 | $publicSuffixListArray = $this->convertListToArray($cacheFile); |
| 86 | 86 | foreach ($publicSuffixListArray as $domain => $data) { |
| 87 | 87 | // do not empty existing PHP cache file if source TXT is empty |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $data = array_filter( |
| 147 | 147 | $data, |
| 148 | - function ($line) { |
|
| 148 | + function($line) { |
|
| 149 | 149 | return false === strpos($line, '//'); |
| 150 | 150 | } |
| 151 | 151 | ); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function writePhpCache(array $publicSuffixList): int |
| 216 | 216 | { |
| 217 | - $data = '<?php' . PHP_EOL . 'static $data = ' . var_export($publicSuffixList, true) . '; $result =& $data; unset($data); return $result;'; |
|
| 217 | + $data = '<?php'.PHP_EOL.'static $data = '.var_export($publicSuffixList, true).'; $result =& $data; unset($data); return $result;'; |
|
| 218 | 218 | |
| 219 | 219 | return $this->write(self::PDP_PSL_PHP_FILE, $data); |
| 220 | 220 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | protected function varExportToFile($basename, array $input): int |
| 231 | 231 | { |
| 232 | - $data = '<?php' . PHP_EOL . 'static $data = ' . var_export($input, true) . '; $result =& $data; unset($data); return $result;'; |
|
| 232 | + $data = '<?php'.PHP_EOL.'static $data = '.var_export($input, true).'; $result =& $data; unset($data); return $result;'; |
|
| 233 | 233 | |
| 234 | 234 | return $this->write($basename, $data); |
| 235 | 235 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | static $LIST_STATIC = []; |
| 251 | 251 | |
| 252 | 252 | $cacheBasename = self::$domainList[$list] ?? self::PDP_PSL_PHP_FILE; |
| 253 | - $cacheFile = $this->cacheDir . '/' . $cacheBasename; |
|
| 253 | + $cacheFile = $this->cacheDir.'/'.$cacheBasename; |
|
| 254 | 254 | $cacheKey = md5($cacheFile); |
| 255 | 255 | |
| 256 | 256 | if ( |
@@ -385,11 +385,11 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | protected function isValidSection($previousStatus, $line, $section): bool |
| 387 | 387 | { |
| 388 | - if (!$previousStatus && 0 === strpos($line, '// ===BEGIN ' . $section . ' DOMAINS===')) { |
|
| 388 | + if (!$previousStatus && 0 === strpos($line, '// ===BEGIN '.$section.' DOMAINS===')) { |
|
| 389 | 389 | return true; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - if ($previousStatus && 0 === strpos($line, '// ===END ' . $section . ' DOMAINS===')) { |
|
| 392 | + if ($previousStatus && 0 === strpos($line, '// ===END '.$section.' DOMAINS===')) { |
|
| 393 | 393 | return false; |
| 394 | 394 | } |
| 395 | 395 | |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | protected function write($filename, $data): int |
| 410 | 410 | { |
| 411 | 411 | $data = trim($data); |
| 412 | - $filePath = $this->cacheDir . '/' . $filename; |
|
| 412 | + $filePath = $this->cacheDir.'/'.$filename; |
|
| 413 | 413 | |
| 414 | 414 | if (empty($data)) { |
| 415 | 415 | throw new \Exception("No data to write into '{$filePath}'"); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | flock($fp, LOCK_UN); |
| 433 | 433 | fclose($fp); |
| 434 | 434 | |
| 435 | - $result = (int)$result; |
|
| 435 | + $result = (int) $result; |
|
| 436 | 436 | |
| 437 | 437 | return $result; |
| 438 | 438 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * PHP Domain Parser: Public Suffix List based URL parsing. |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function getSchemeless(): string |
| 106 | 106 | { |
| 107 | - return preg_replace(Parser::SCHEME_PATTERN, '//', (string)$this, 1); |
|
| 107 | + return preg_replace(Parser::SCHEME_PATTERN, '//', (string) $this, 1); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -117,25 +117,25 @@ discard block |
||
| 117 | 117 | $url = ''; |
| 118 | 118 | |
| 119 | 119 | if ($this->scheme) { |
| 120 | - $url .= $this->scheme . '://'; |
|
| 120 | + $url .= $this->scheme.'://'; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if ($this->user) { |
| 124 | 124 | $url .= urlencode($this->user); |
| 125 | 125 | if ($this->pass) { |
| 126 | - $url .= ':' . urlencode($this->pass); |
|
| 126 | + $url .= ':'.urlencode($this->pass); |
|
| 127 | 127 | } |
| 128 | 128 | $url .= '@'; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $host = (string)$this->host; |
|
| 131 | + $host = (string) $this->host; |
|
| 132 | 132 | |
| 133 | 133 | if ($host) { |
| 134 | 134 | $url .= $host; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if ($this->port) { |
| 138 | - $url .= ':' . (int)$this->port; |
|
| 138 | + $url .= ':'.(int) $this->port; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if ($this->path) { |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if ($this->query) { |
| 146 | - $url .= '?' . $this->query; |
|
| 146 | + $url .= '?'.$this->query; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if ($this->fragment) { |
| 150 | - $url .= '#' . urlencode($this->fragment); |
|
| 150 | + $url .= '#'.urlencode($this->fragment); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | return $url; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | 'scheme' => $this->getScheme(), |
| 165 | 165 | 'user' => $this->getUser(), |
| 166 | 166 | 'pass' => $this->getPass(), |
| 167 | - 'host' => (string)$this->getHost(), |
|
| 167 | + 'host' => (string) $this->getHost(), |
|
| 168 | 168 | 'subdomain' => $this->getHost()->getSubdomain(), |
| 169 | 169 | 'registrableDomain' => $this->getHost()->getRegistrableDomain(), |
| 170 | 170 | 'publicSuffix' => $this->getHost()->getPublicSuffix(), |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * PHP Domain Parser: Public Suffix List based URL parsing. |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * PHP Domain Parser: Public Suffix List based URL parsing. |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * PHP Domain Parser: Public Suffix List based URL parsing. |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $errNo = curl_errno($ch); |
| 57 | 57 | if ($errNo) { |
| 58 | - throw new CurlHttpAdapterException("CURL error [{$errNo}]: " . curl_error($ch), $errNo); |
|
| 58 | + throw new CurlHttpAdapterException("CURL error [{$errNo}]: ".curl_error($ch), $errNo); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 62 | 62 | if ($responseCode !== 200) { |
| 63 | - throw new CurlHttpAdapterException('Wrong HTTP response code: ' . $responseCode, $responseCode); |
|
| 63 | + throw new CurlHttpAdapterException('Wrong HTTP response code: '.$responseCode, $responseCode); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | curl_close($ch); |