@@ -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 |
@@ -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 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | if (preg_match($this->urlRegex, $this->url, $matches) !== 0) { |
61 | 61 | $total = count($matches); |
62 | 62 | for ($i = 1; $i < $total; $i++) { |
63 | - $this->thumbnailUrl = str_replace('${'. $i . '}', $matches[$i], $this->thumbnailUrl); |
|
63 | + $this->thumbnailUrl = str_replace('${'.$i.'}', $matches[$i], $this->thumbnailUrl); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // Match only options (not ${number}) |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public static function generateThumbnail($imageStr, $target, $maxWidth, $maxHeight, $crop = false) |
34 | 34 | { |
35 | - if (! touch($target)) { |
|
35 | + if (!touch($target)) { |
|
36 | 36 | throw new ImageConvertException('Target file is not writable.'); |
37 | 37 | } |
38 | 38 | |
39 | - if ($crop && ($maxWidth == 0 || $maxHeight == 0)) { |
|
39 | + if ($crop && ($maxWidth == 0 || $maxHeight == 0)) { |
|
40 | 40 | throw new ImageConvertException('Both width and height must be provided for cropping'); |
41 | 41 | } |
42 | 42 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | throw new ImageConvertException('Could not generate the thumbnail from source image.'); |
68 | 68 | } |
69 | 69 | |
70 | - if (! imagecopyresized( |
|
70 | + if (!imagecopyresized( |
|
71 | 71 | $targetImg, |
72 | 72 | $sourceImg, |
73 | 73 | 0, |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $diffHeight = !empty($maxHeight) ? $originalHeight - $maxHeight : false; |
109 | 109 | |
110 | 110 | if (($diffHeight === false && $diffWidth !== false) |
111 | - || ($diffWidth > $diffHeight && ! $crop) |
|
111 | + || ($diffWidth > $diffHeight && !$crop) |
|
112 | 112 | || ($diffWidth < $diffHeight && $crop) |
113 | 113 | ) { |
114 | 114 | $finalWidth = $maxWidth; |