@@ -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 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public static function getDomain(string $url): string |
20 | 20 | { |
21 | 21 | if (!parse_url($url, PHP_URL_SCHEME)) { |
22 | - $url = 'http://' . $url; |
|
22 | + $url = 'http://'.$url; |
|
23 | 23 | } |
24 | 24 | return strtolower(parse_url($url, PHP_URL_HOST)); |
25 | 25 | } |
@@ -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 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public static function loadJson(string $jsonFile): array |
26 | 26 | { |
27 | - if (! file_exists($jsonFile) || ! is_readable($jsonFile)) { |
|
27 | + if (!file_exists($jsonFile) || !is_readable($jsonFile)) { |
|
28 | 28 | throw new IOException('JSON resource file not found or not readable.'); |
29 | 29 | } |
30 | 30 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $error = json_last_error(); |
34 | 34 | $msg = json_last_error_msg(); |
35 | 35 | throw new BadRulesException( |
36 | - 'An error occured while parsing JSON file: error code #' . $error . ': ' . $msg |
|
36 | + 'An error occured while parsing JSON file: error code #'.$error.': '.$msg |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 |
@@ -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 |