@@ -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 | |
@@ -121,7 +121,7 @@ discard block  | 
                                                    ||
| 121 | 121 | *  | 
                                                        
| 122 | 122 | * @return int|bool length of $data or false if we need to stop the download  | 
                                                        
| 123 | 123 | */  | 
                                                        
| 124 | -        return function (&$ch, $data) use (&$content, &$thumbnail, &$isRedirected) { | 
                                                        |
| 124 | +        return function(&$ch, $data) use (&$content, &$thumbnail, &$isRedirected) { | 
                                                        |
| 125 | 125 | $content .= $data;  | 
                                                        
| 126 | 126 | $responseCode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);  | 
                                                        
| 127 | 127 | |
@@ -134,7 +134,7 @@ discard block  | 
                                                    ||
| 134 | 134 | }  | 
                                                        
| 135 | 135 | // After a redirection, the content type will keep the previous request value  | 
                                                        
| 136 | 136 | // until it finds the next content-type header.  | 
                                                        
| 137 | -            if (! $isRedirected || strpos(strtolower($data), 'content-type') !== false) { | 
                                                        |
| 137 | +            if (!$isRedirected || strpos(strtolower($data), 'content-type') !== false) { | 
                                                        |
| 138 | 138 | $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);  | 
                                                        
| 139 | 139 | }  | 
                                                        
| 140 | 140 |              if (!empty($contentType) && strpos($contentType, 'text/html') === false) { | 
                                                        
@@ -163,7 +163,7 @@ discard block  | 
                                                    ||
| 163 | 163 |          if (preg_match($this->urlRegex, $content, $matches) !== 0) { | 
                                                        
| 164 | 164 | $total = count($matches);  | 
                                                        
| 165 | 165 |              for ($i = 1; $i < $total; $i++) { | 
                                                        
| 166 | -                $thumbnailUrl = str_replace('${'. $i . '}', $matches[$i], $thumbnailUrl); | 
                                                        |
| 166 | +                $thumbnailUrl = str_replace('${'.$i.'}', $matches[$i], $thumbnailUrl); | 
                                                        |
| 167 | 167 | }  | 
                                                        
| 168 | 168 | |
| 169 | 169 |              // Match only options (not ${number}) | 
                                                        
@@ -182,7 +182,7 @@ discard block  | 
                                                    ||
| 182 | 182 | */  | 
                                                        
| 183 | 183 | public function checkRules($rules)  | 
                                                        
| 184 | 184 |      { | 
                                                        
| 185 | - if (! FinderUtils::checkMandatoryRules($rules, [  | 
                                                        |
| 185 | + if (!FinderUtils::checkMandatoryRules($rules, [  | 
                                                        |
| 186 | 186 | 'image_regex',  | 
                                                        
| 187 | 187 | 'thumbnail_url'  | 
                                                        
| 188 | 188 |          ])) { | 
                                                        
@@ -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}) |