Completed
Push — master ( 47675f...e2515d )
by Arthur
16s queued 13s
created
src/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/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/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/Application/WebAccess/WebAccessCUrl.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
         }
65 65
 
66 66
         $locale = setlocale(LC_COLLATE, '0');
67
-        $cookie = ConfigManager::get('settings.path.cache') . '/cookie.txt';
67
+        $cookie = ConfigManager::get('settings.path.cache').'/cookie.txt';
68 68
         $userAgent =
69 69
             'Mozilla/5.0 (X11; Linux x86_64; rv:45.0; WebThumbnailer)'
70 70
             . ' Gecko/20100101 Firefox/45.0';
71 71
         $acceptLanguage =
72
-            substr($locale ?: 'en', 0, 2) . ',en-US;q=0.7,en;q=0.3';
72
+            substr($locale ?: 'en', 0, 2).',en-US;q=0.7,en;q=0.3';
73 73
         $maxRedirs = 6;
74 74
 
75 75
         $ch = curl_init($url);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         curl_setopt(
85 85
             $ch,
86 86
             CURLOPT_HTTPHEADER,
87
-            ['Accept-Language: ' . $acceptLanguage]
87
+            ['Accept-Language: '.$acceptLanguage]
88 88
         );
89 89
         curl_setopt($ch, CURLOPT_MAXREDIRS, $maxRedirs);
90 90
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         curl_setopt(
102 102
             $ch,
103 103
             CURLOPT_PROGRESSFUNCTION,
104
-            function ($arg0, $arg1, $arg2) use ($maxBytes) {
104
+            function($arg0, $arg1, $arg2) use ($maxBytes) {
105 105
                 $downloaded = $arg2;
106 106
                 // Non-zero return stops downloading
107 107
                 return ($downloaded > $maxBytes) ? 1 : 0;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         curl_close($ch);
123 123
 
124 124
         if (!is_string($response)) {
125
-            return [[0 => 'curl_exec() error #' . $errorNo . ': ' . $errorStr], false];
125
+            return [[0 => 'curl_exec() error #'.$errorNo.': '.$errorStr], false];
126 126
         }
127 127
 
128 128
         // Formatting output like the fallback method
Please login to merge, or discard this patch.
src/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/Application/WebAccess/WebAccessFactory.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 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
 
Please login to merge, or discard this patch.
src/Application/ConfigManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     /** @var string[] List of JSON configuration file path. */
21 21
     public static $configFiles = [
22
-        FileUtils::RESOURCES_PATH . 'settings.json',
22
+        FileUtils::RESOURCES_PATH.'settings.json',
23 23
     ];
24 24
 
25 25
     /** @var mixed[] Loaded config array. */
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public static function clear(): void
74 74
     {
75 75
         static::$configFiles = [
76
-            FileUtils::RESOURCES_PATH . 'settings.json',
76
+            FileUtils::RESOURCES_PATH.'settings.json',
77 77
         ];
78 78
         static::reload();
79 79
     }
Please login to merge, or discard this patch.
src/Application/CacheManager.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             static::rebuildCacheFolders();
53 53
             return static::getCachePath($type, true);
54 54
         } elseif (!$path) {
55
-            throw new IOException('Cache folders are not writable: ' . $cache);
55
+            throw new IOException('Cache folders are not writable: '.$cache);
56 56
         }
57 57
         return $path;
58 58
     }
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
         }
96 96
 
97 97
         if ($type === static::TYPE_THUMB) {
98
-            $suffix = $width . $height . ($crop ? '1' : '0') . '.jpg';
98
+            $suffix = $width.$height.($crop ? '1' : '0').'.jpg';
99 99
         } else {
100
-            $suffix = $width . $height;
100
+            $suffix = $width.$height;
101 101
         }
102 102
 
103
-        return $domainFolder . static::getThumbFilename($url) . $suffix;
103
+        return $domainFolder.static::getThumbFilename($url).$suffix;
104 104
     }
105 105
 
106 106
     /**
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
     protected static function createDomainThumbCacheFolder(string $domain, string $type): void
150 150
     {
151 151
         $cachePath = static::getCachePath($type);
152
-        $domainFolder = $cachePath . $domain;
152
+        $domainFolder = $cachePath.$domain;
153 153
         if (!file_exists($domainFolder)) {
154 154
             mkdir($domainFolder, 0775, false);
155
-            touch($domainFolder . '/' . static::$CLEAN_FILE);
155
+            touch($domainFolder.'/'.static::$CLEAN_FILE);
156 156
         }
157 157
         static::createHtaccessFile($cachePath, $type === static::TYPE_THUMB);
158 158
     }
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
     protected static function createHtaccessFile(string $path, bool $allowed = false): void
171 171
     {
172 172
         $apacheVersion = ConfigManager::get('settings.apache_version', '');
173
-        $htaccessFile = $path . '.htaccess';
173
+        $htaccessFile = $path.'.htaccess';
174 174
         if (file_exists($htaccessFile)) {
175 175
             return;
176 176
         }
177
-        $templateFile = file_exists(FileUtils::RESOURCES_PATH . 'htaccess' . $apacheVersion . '_template')
178
-            ? FileUtils::RESOURCES_PATH . 'htaccess' . $apacheVersion . '_template'
179
-            : FileUtils::RESOURCES_PATH . 'htaccess_template';
177
+        $templateFile = file_exists(FileUtils::RESOURCES_PATH.'htaccess'.$apacheVersion.'_template')
178
+            ? FileUtils::RESOURCES_PATH.'htaccess'.$apacheVersion.'_template'
179
+            : FileUtils::RESOURCES_PATH.'htaccess_template';
180 180
         $template = TemplatePolyfill::get($templateFile);
181 181
         $template->setVar([
182 182
             'new_all' => $allowed ? 'granted' : 'denied',
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     protected static function checkCacheType(string $type): bool
212 212
     {
213 213
         if ($type != static::TYPE_THUMB && $type != static::TYPE_FINDER) {
214
-            throw new CacheException('Unknown cache type ' . $type);
214
+            throw new CacheException('Unknown cache type '.$type);
215 215
         }
216 216
 
217 217
         return true;
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
     protected static function rebuildCacheFolders(): void
227 227
     {
228 228
         $mainFolder = ConfigManager::get('settings.path.cache', 'cache/');
229
-        if (! is_dir($mainFolder)) {
229
+        if (!is_dir($mainFolder)) {
230 230
             mkdir($mainFolder, 0755);
231 231
         }
232
-        if (! is_dir($mainFolder . static::TYPE_THUMB)) {
233
-            mkdir($mainFolder . static::TYPE_THUMB, 0755);
232
+        if (!is_dir($mainFolder.static::TYPE_THUMB)) {
233
+            mkdir($mainFolder.static::TYPE_THUMB, 0755);
234 234
         }
235
-        if (! is_readable($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
236
-            touch($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep');
235
+        if (!is_readable($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
236
+            touch($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep');
237 237
         }
238
-        if (! is_dir($mainFolder . static::TYPE_FINDER)) {
239
-            mkdir($mainFolder . static::TYPE_FINDER, 0755);
238
+        if (!is_dir($mainFolder.static::TYPE_FINDER)) {
239
+            mkdir($mainFolder.static::TYPE_FINDER, 0755);
240 240
         }
241
-        if (! is_readable($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
242
-            touch($mainFolder . static::TYPE_FINDER . DIRECTORY_SEPARATOR . '.gitkeep');
241
+        if (!is_readable($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
242
+            touch($mainFolder.static::TYPE_FINDER.DIRECTORY_SEPARATOR.'.gitkeep');
243 243
         }
244 244
     }
245 245
 
Please login to merge, or discard this patch.