Completed
Push — master ( 776356...cb5aaa )
by Arthur
04:00
created
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
     }
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
         }
95 95
 
96 96
         if ($type === static::TYPE_THUMB) {
97
-            $suffix = $width . $height . ($crop ? '1' : '0') . '.jpg';
97
+            $suffix = $width.$height.($crop ? '1' : '0').'.jpg';
98 98
         } else {
99
-            $suffix = $width . $height;
99
+            $suffix = $width.$height;
100 100
         }
101 101
 
102
-        return $domainFolder . static::getThumbFilename($url) . $suffix;
102
+        return $domainFolder.static::getThumbFilename($url).$suffix;
103 103
     }
104 104
 
105 105
     /**
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
     protected static function createDomainThumbCacheFolder(string $domain, string $type): void
149 149
     {
150 150
         $cachePath = static::getCachePath($type);
151
-        $domainFolder = $cachePath . $domain;
151
+        $domainFolder = $cachePath.$domain;
152 152
         if (!file_exists($domainFolder)) {
153 153
             mkdir($domainFolder, 0775, false);
154
-            touch($domainFolder . '/' . static::$CLEAN_FILE);
154
+            touch($domainFolder.'/'.static::$CLEAN_FILE);
155 155
         }
156 156
         static::createHtaccessFile($cachePath, $type === static::TYPE_THUMB);
157 157
     }
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
     protected static function createHtaccessFile(string $path, bool $allowed = false): void
170 170
     {
171 171
         $apacheVersion = ConfigManager::get('settings.apache_version', '');
172
-        $htaccessFile = $path . '.htaccess';
172
+        $htaccessFile = $path.'.htaccess';
173 173
         if (file_exists($htaccessFile)) {
174 174
             return;
175 175
         }
176
-        $templateFile = file_exists(FileUtils::RESOURCES_PATH . 'htaccess' . $apacheVersion . '_template')
177
-            ? FileUtils::RESOURCES_PATH . 'htaccess' . $apacheVersion . '_template'
178
-            : FileUtils::RESOURCES_PATH . 'htaccess_template';
176
+        $templateFile = file_exists(FileUtils::RESOURCES_PATH.'htaccess'.$apacheVersion.'_template')
177
+            ? FileUtils::RESOURCES_PATH.'htaccess'.$apacheVersion.'_template'
178
+            : FileUtils::RESOURCES_PATH.'htaccess_template';
179 179
         $template = new \Text_Template($templateFile);
180 180
         $template->setVar([
181 181
             'new_all' => $allowed ? 'granted' : 'denied',
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     protected static function checkCacheType(string $type): bool
211 211
     {
212 212
         if ($type != static::TYPE_THUMB && $type != static::TYPE_FINDER) {
213
-            throw new CacheException('Unknown cache type ' . $type);
213
+            throw new CacheException('Unknown cache type '.$type);
214 214
         }
215 215
 
216 216
         return true;
@@ -225,20 +225,20 @@  discard block
 block discarded – undo
225 225
     protected static function rebuildCacheFolders(): void
226 226
     {
227 227
         $mainFolder = ConfigManager::get('settings.path.cache', 'cache/');
228
-        if (! is_dir($mainFolder)) {
228
+        if (!is_dir($mainFolder)) {
229 229
             mkdir($mainFolder, 0755);
230 230
         }
231
-        if (! is_dir($mainFolder . static::TYPE_THUMB)) {
232
-            mkdir($mainFolder . static::TYPE_THUMB, 0755);
231
+        if (!is_dir($mainFolder.static::TYPE_THUMB)) {
232
+            mkdir($mainFolder.static::TYPE_THUMB, 0755);
233 233
         }
234
-        if (! is_readable($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
235
-            touch($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep');
234
+        if (!is_readable($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
235
+            touch($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep');
236 236
         }
237
-        if (! is_dir($mainFolder . static::TYPE_FINDER)) {
238
-            mkdir($mainFolder . static::TYPE_FINDER, 0755);
237
+        if (!is_dir($mainFolder.static::TYPE_FINDER)) {
238
+            mkdir($mainFolder.static::TYPE_FINDER, 0755);
239 239
         }
240
-        if (! is_readable($mainFolder . static::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
241
-            touch($mainFolder . static::TYPE_FINDER . DIRECTORY_SEPARATOR . '.gitkeep');
240
+        if (!is_readable($mainFolder.static::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
241
+            touch($mainFolder.static::TYPE_FINDER.DIRECTORY_SEPARATOR.'.gitkeep');
242 242
         }
243 243
     }
244 244
 
Please login to merge, or discard this patch.