@@ -31,13 +31,13 @@ |
||
| 31 | 31 | $context = $this->getContext($timeout, false); |
| 32 | 32 | stream_context_set_default($context); |
| 33 | 33 | list($headers, $finalUrl) = $this->getRedirectedHeaders($url, $timeout, $maxRedr); |
| 34 | - if (! $headers || strpos($headers[0], '200 OK') === false) { |
|
| 34 | + if (!$headers || strpos($headers[0], '200 OK') === false) { |
|
| 35 | 35 | $context = $this->getContext($timeout, true); |
| 36 | 36 | stream_context_set_default($context); |
| 37 | 37 | list($headers, $finalUrl) = $this->getRedirectedHeaders($url, $timeout, $maxRedr); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if (! $headers) { |
|
| 40 | + if (!$headers) { |
|
| 41 | 41 | return array($headers, false); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public static function checkExtensionRequirements(array $required): bool |
| 19 | 19 | { |
| 20 | 20 | foreach ($required as $extension) { |
| 21 | - if (! extension_loaded($extension)) { |
|
| 21 | + if (!extension_loaded($extension)) { |
|
| 22 | 22 | throw new MissingRequirementException(sprintf( |
| 23 | 23 | 'PHP extension php-%s is required and must be loaded', |
| 24 | 24 | $extension |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | new \RecursiveDirectoryIterator( |
| 51 | 51 | $path, |
| 52 | 52 | \FilesystemIterator::SKIP_DOTS | |
| 53 | - \FilesystemIterator::UNIX_PATHS |
|
| 53 | + \FilesystemIterator::UNIX_PATHS |
|
| 54 | 54 | ), |
| 55 | 55 | \RecursiveIteratorIterator::CHILD_FIRST |
| 56 | 56 | ) as $value |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | /** @var string Path to resources folder. */ |
| 10 | 10 | public const RESOURCES_PATH = |
| 11 | - __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR; |
|
| 11 | + __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Build the path from all given folders, with a trailing /. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | return false; |
| 28 | 28 | } |
| 29 | 29 | foreach ($args as $arg) { |
| 30 | - $out .= rtrim(rtrim($arg, '/'), '\\') . DIRECTORY_SEPARATOR; |
|
| 30 | + $out .= rtrim(rtrim($arg, '/'), '\\').DIRECTORY_SEPARATOR; |
|
| 31 | 31 | } |
| 32 | 32 | return is_dir($out) ? $out : false; |
| 33 | 33 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | public static function isMetaSize(string $size): bool |
| 55 | 55 | { |
| 56 | - $metaSize = array ( |
|
| 56 | + $metaSize = array( |
|
| 57 | 57 | WebThumbnailer::SIZE_SMALL, |
| 58 | 58 | WebThumbnailer::SIZE_MEDIUM, |
| 59 | 59 | WebThumbnailer::SIZE_LARGE |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public static function buildRegex(string $regex, string $flags): string |
| 24 | 24 | { |
| 25 | - return '{' . $regex . '}' . $flags; |
|
| 25 | + return '{'.$regex.'}'.$flags; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | return false; |
| 45 | 45 | } |
| 46 | 46 | } else { |
| 47 | - if (! isset($rules[$value])) { |
|
| 47 | + if (!isset($rules[$value])) { |
|
| 48 | 48 | return false; |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if (count(array_intersect($incompatibleFlags, $options)) > 1) { |
| 153 | 153 | $error = 'Only one of these flags can be set between: '; |
| 154 | 154 | foreach ($incompatibleFlags as $flag) { |
| 155 | - $error .= $flag . ' '; |
|
| 155 | + $error .= $flag.' '; |
|
| 156 | 156 | } |
| 157 | 157 | throw new BadRulesException($error); |
| 158 | 158 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if (empty($thumbUrl)) { |
| 235 | - $error = 'No thumbnail could be found using ' . $this->finder->getName() . ' finder: ' . $this->url; |
|
| 235 | + $error = 'No thumbnail could be found using '.$this->finder->getName().' finder: '.$this->url; |
|
| 236 | 236 | throw new ThumbnailNotFoundException($error); |
| 237 | 237 | } |
| 238 | 238 | |
@@ -339,13 +339,13 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | if (strpos($headers[0], '200') === false) { |
| 341 | 341 | throw new DownloadException( |
| 342 | - 'Unreachable thumbnail URL. HTTP ' . $headers[0] . '.' . PHP_EOL . |
|
| 343 | - ' - thumbnail URL: ' . $thumbUrl |
|
| 342 | + 'Unreachable thumbnail URL. HTTP '.$headers[0].'.'.PHP_EOL. |
|
| 343 | + ' - thumbnail URL: '.$thumbUrl |
|
| 344 | 344 | ); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | if (empty($data)) { |
| 348 | - throw new DownloadException('Couldn\'t download the thumbnail at ' . $thumbUrl); |
|
| 348 | + throw new DownloadException('Couldn\'t download the thumbnail at '.$thumbUrl); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | // Resize and save it locally. |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | public static function getWebAccess(?string $url = null): WebAccess |
| 20 | 20 | { |
| 21 | 21 | // Local file |
| 22 | - if (! empty($url) && $url[0] === '/') { |
|
| 22 | + if (!empty($url) && $url[0] === '/') { |
|
| 23 | 23 | return new WebAccessLocal(); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | /** @var string[] List of JSON configuration file path. */ |
| 21 | 21 | public static $configFiles = [ |
| 22 | - FileUtils::RESOURCES_PATH . 'settings.json', |
|
| 22 | + FileUtils::RESOURCES_PATH.'settings.json', |
|
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | /** @var mixed[] Loaded config array. */ |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public static function clear(): void |
| 74 | 74 | { |
| 75 | 75 | static::$configFiles = [ |
| 76 | - FileUtils::RESOURCES_PATH . 'settings.json', |
|
| 76 | + FileUtils::RESOURCES_PATH.'settings.json', |
|
| 77 | 77 | ]; |
| 78 | 78 | static::reload(); |
| 79 | 79 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | if (preg_match($this->urlRegex, $this->url, $matches) !== 0) { |
| 55 | 55 | $total = count($matches); |
| 56 | 56 | for ($i = 1; $i < $total; $i++) { |
| 57 | - $this->thumbnailUrl = str_replace('${' . $i . '}', $matches[$i], $this->thumbnailUrl); |
|
| 57 | + $this->thumbnailUrl = str_replace('${'.$i.'}', $matches[$i], $this->thumbnailUrl); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Match only options (not ${number}) |