@@ -32,8 +32,8 @@ |
||
32 | 32 | protected $webAccess; |
33 | 33 | |
34 | 34 | /** |
35 | - * @var string thumbnail_url rule. |
|
36 | - */ |
|
35 | + * @var string thumbnail_url rule. |
|
36 | + */ |
|
37 | 37 | protected $thumbnailUrlFormat; |
38 | 38 | |
39 | 39 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | // With curl, the thumb is extracted during the download |
91 | - if ($this->webAccess instanceof WebAccessCUrl && ! empty($thumbnail)) { |
|
91 | + if ($this->webAccess instanceof WebAccessCUrl && !empty($thumbnail)) { |
|
92 | 92 | return $thumbnail; |
93 | 93 | } |
94 | 94 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return int|bool length of $data or false if we need to stop the download |
121 | 121 | */ |
122 | - return function (&$ch, $data) use (&$content, &$thumbnail) { |
|
122 | + return function(&$ch, $data) use (&$content, &$thumbnail) { |
|
123 | 123 | $content .= $data; |
124 | 124 | $responseCode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE); |
125 | 125 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | if (preg_match($this->urlRegex, $content, $matches) !== 0) { |
154 | 154 | $total = count($matches); |
155 | 155 | for ($i = 1; $i < $total; $i++) { |
156 | - $thumbnailUrl = str_replace('${'. $i . '}', $matches[$i], $thumbnailUrl); |
|
156 | + $thumbnailUrl = str_replace('${'.$i.'}', $matches[$i], $thumbnailUrl); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // Match only options (not ${number}) |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function checkRules($rules) |
174 | 174 | { |
175 | - if (! FinderUtils::checkMandatoryRules($rules, [ |
|
175 | + if (!FinderUtils::checkMandatoryRules($rules, [ |
|
176 | 176 | 'image_regex', |
177 | 177 | 'thumbnail_url' |
178 | 178 | ])) { |
@@ -30,8 +30,8 @@ |
||
30 | 30 | |
31 | 31 | $size = $this->getOptionValue('size'); |
32 | 32 | // One size is actually no suffix... |
33 | - $size = ! empty($size) ? '_'. $size : ''; |
|
34 | - $thumb = preg_replace('#(.*)_\w(\.\w+)$#i', '$1'. $size .'$2', $thumb); |
|
33 | + $size = !empty($size) ? '_'.$size : ''; |
|
34 | + $thumb = preg_replace('#(.*)_\w(\.\w+)$#i', '$1'.$size.'$2', $thumb); |
|
35 | 35 | return $thumb; |
36 | 36 | } |
37 | 37 | } |
@@ -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 |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public static function getDomain($url) |
22 | 22 | { |
23 | - if (! parse_url($url, PHP_URL_SCHEME)) { |
|
24 | - $url = 'http://' . $url; |
|
23 | + if (!parse_url($url, PHP_URL_SCHEME)) { |
|
24 | + $url = 'http://'.$url; |
|
25 | 25 | } |
26 | 26 | return strtolower(parse_url($url, PHP_URL_HOST)); |
27 | 27 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public static function generateRelativeUrlFromPath($server, $path) |
42 | 42 | { |
43 | 43 | if (isset($server['DOCUMENT_ROOT'])) { |
44 | - $root = ! empty($server['DOCUMENT_ROOT']) ? rtrim($server['DOCUMENT_ROOT'], '/') .'/' : ''; |
|
44 | + $root = !empty($server['DOCUMENT_ROOT']) ? rtrim($server['DOCUMENT_ROOT'], '/').'/' : ''; |
|
45 | 45 | return substr($path, strlen($root)); |
46 | 46 | } |
47 | 47 | return $path; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public static function buildRegex($regex, $flags) |
26 | 26 | { |
27 | - return '{' . $regex . '}' . $flags; |
|
27 | + return '{'.$regex.'}'.$flags; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | } else { |
49 | - if (! isset($rules[$value])) { |
|
49 | + if (!isset($rules[$value])) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | } |
@@ -26,14 +26,14 @@ |
||
26 | 26 | */ |
27 | 27 | public static function loadJson($jsonFile) |
28 | 28 | { |
29 | - if (! file_exists($jsonFile) || ! is_readable($jsonFile)) { |
|
29 | + if (!file_exists($jsonFile) || !is_readable($jsonFile)) { |
|
30 | 30 | throw new IOException('JSON resource file not found or not readable.'); |
31 | 31 | } |
32 | 32 | $data = json_decode(file_get_contents($jsonFile), true); |
33 | 33 | if ($data === null) { |
34 | 34 | $error = json_last_error(); |
35 | 35 | $msg = json_last_error_msg(); |
36 | - throw new BadRulesException('An error occured while parsing JSON file: error code #'. $error .': '. $msg); |
|
36 | + throw new BadRulesException('An error occured while parsing JSON file: error code #'.$error.': '.$msg); |
|
37 | 37 | } |
38 | 38 | return $data; |
39 | 39 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | public static function isMetaSize($size) |
52 | 52 | { |
53 | - $metaSize = array ( |
|
53 | + $metaSize = array( |
|
54 | 54 | WebThumbnailer::SIZE_SMALL, |
55 | 55 | WebThumbnailer::SIZE_MEDIUM, |
56 | 56 | WebThumbnailer::SIZE_LARGE |
@@ -16,7 +16,7 @@ |
||
16 | 16 | public static function checkExtensionRequirements($required) |
17 | 17 | { |
18 | 18 | foreach ($required as $extension) { |
19 | - if (! extension_loaded($extension)) { |
|
19 | + if (!extension_loaded($extension)) { |
|
20 | 20 | throw new MissingRequirementException(sprintf( |
21 | 21 | 'PHP extension php-%s is required and must be loaded', |
22 | 22 | $extension |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public static function getWebAccess($url = null) |
22 | 22 | { |
23 | 23 | // Local file |
24 | - if (! empty($url) && $url[0] === '/') { |
|
24 | + if (!empty($url) && $url[0] === '/') { |
|
25 | 25 | return new WebAccessLocal(); |
26 | 26 | } |
27 | 27 |