Passed
Pull Request — master (#22)
by Arthur
01:43
created
src/WebThumbnailer/Application/WebAccess/WebAccessPHP.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/WebThumbnailer/Utils/ApplicationUtils.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/WebThumbnailer/Utils/UrlUtils.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/WebThumbnailer/Utils/FileUtils.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/WebThumbnailer/Utils/SizeUtils.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/WebThumbnailer/Utils/DataUtils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/WebThumbnailer/Utils/FinderUtils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/WebThumbnailer/Application/Thumbnailer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/WebThumbnailer/Application/CacheManager.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             static::rebuildCacheFolders();
52 52
             return static::getCachePath($type, true);
53 53
         } elseif (!$path) {
54
-            throw new IOException('Cache folders are not writable: ' . $cache);
54
+            throw new IOException('Cache folders are not writable: '.$cache);
55 55
         }
56 56
         return $path;
57 57
     }
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
         static::createDomainThumbCacheFolder($domainHash, $type);
84 84
         $domainFolder = FileUtils::getPath(static::getCachePath($type), $domainHash);
85 85
         if ($type === static::TYPE_THUMB) {
86
-            $suffix = $width . $height . ($crop ? '1' : '0') . '.jpg';
86
+            $suffix = $width.$height.($crop ? '1' : '0').'.jpg';
87 87
         } else {
88
-            $suffix = $width . $height;
88
+            $suffix = $width.$height;
89 89
         }
90
-        return $domainFolder . static::getThumbFilename($url) . $suffix;
90
+        return $domainFolder.static::getThumbFilename($url).$suffix;
91 91
     }
92 92
 
93 93
     /**
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
     protected static function createDomainThumbCacheFolder(string $domain, string $type): void
137 137
     {
138 138
         $cachePath = static::getCachePath($type);
139
-        $domainFolder = $cachePath . $domain;
139
+        $domainFolder = $cachePath.$domain;
140 140
         if (!file_exists($domainFolder)) {
141 141
             mkdir($domainFolder, 0775, false);
142
-            touch($domainFolder . '/' . static::$CLEAN_FILE);
142
+            touch($domainFolder.'/'.static::$CLEAN_FILE);
143 143
         }
144 144
         static::createHtaccessFile($cachePath, $type === static::TYPE_THUMB);
145 145
     }
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
     protected static function createHtaccessFile(string $path, bool $allowed = false): void
158 158
     {
159 159
         $apacheVersion = ConfigManager::get('settings.apache_version', '');
160
-        $htaccessFile = $path . '.htaccess';
160
+        $htaccessFile = $path.'.htaccess';
161 161
         if (file_exists($htaccessFile)) {
162 162
             return;
163 163
         }
164
-        $templateFile = file_exists(FileUtils::RESOURCES_PATH . 'htaccess' . $apacheVersion . '_template')
165
-            ? FileUtils::RESOURCES_PATH . 'htaccess' . $apacheVersion . '_template'
166
-            : FileUtils::RESOURCES_PATH . 'htaccess_template';
164
+        $templateFile = file_exists(FileUtils::RESOURCES_PATH.'htaccess'.$apacheVersion.'_template')
165
+            ? FileUtils::RESOURCES_PATH.'htaccess'.$apacheVersion.'_template'
166
+            : FileUtils::RESOURCES_PATH.'htaccess_template';
167 167
         $template = new \Text_Template($templateFile);
168 168
         $template->setVar([
169 169
             'new_all' => $allowed ? 'granted' : 'denied',
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     protected static function checkCacheType(string $type): bool
199 199
     {
200 200
         if ($type != static::TYPE_THUMB && $type != static::TYPE_FINDER) {
201
-            throw new CacheException('Unknown cache type ' . $type);
201
+            throw new CacheException('Unknown cache type '.$type);
202 202
         }
203 203
 
204 204
         return true;
@@ -213,20 +213,20 @@  discard block
 block discarded – undo
213 213
     protected static function rebuildCacheFolders(): void
214 214
     {
215 215
         $mainFolder = ConfigManager::get('settings.path.cache', 'cache/');
216
-        if (! is_dir($mainFolder)) {
216
+        if (!is_dir($mainFolder)) {
217 217
             mkdir($mainFolder, 0755);
218 218
         }
219
-        if (! is_dir($mainFolder . static::TYPE_THUMB)) {
220
-            mkdir($mainFolder . static::TYPE_THUMB, 0755);
219
+        if (!is_dir($mainFolder.static::TYPE_THUMB)) {
220
+            mkdir($mainFolder.static::TYPE_THUMB, 0755);
221 221
         }
222
-        if (! is_readable($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
223
-            touch($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep');
222
+        if (!is_readable($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
223
+            touch($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep');
224 224
         }
225
-        if (! is_dir($mainFolder . static::TYPE_FINDER)) {
226
-            mkdir($mainFolder . static::TYPE_FINDER, 0755);
225
+        if (!is_dir($mainFolder.static::TYPE_FINDER)) {
226
+            mkdir($mainFolder.static::TYPE_FINDER, 0755);
227 227
         }
228
-        if (! is_readable($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
229
-            touch($mainFolder . static::TYPE_FINDER . DIRECTORY_SEPARATOR . '.gitkeep');
228
+        if (!is_readable($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
229
+            touch($mainFolder.static::TYPE_FINDER.DIRECTORY_SEPARATOR.'.gitkeep');
230 230
         }
231 231
     }
232 232
 
Please login to merge, or discard this patch.