Completed
Push — master ( 81c88a...07a9be )
by Arthur
04:09 queued 02:00
created
src/WebThumbnailer/Application/CacheManager.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * Thumbnails image cache.
27 27
      */
28
-    const TYPE_THUMB  = 'thumb';
28
+    const TYPE_THUMB = 'thumb';
29 29
     /**
30 30
      * Finder cache.
31 31
      */
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             self::rebuildCacheFolders();
56 56
             return self::getCachePath($type, true);
57 57
         } elseif (!$path) {
58
-            throw new IOException('Cache folders are not writable: '. $cache);
58
+            throw new IOException('Cache folders are not writable: '.$cache);
59 59
         }
60 60
         return $path;
61 61
     }
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
         self::createDomainThumbCacheFolder($domainHash, $type);
79 79
         $domainFolder = FileUtils::getPath(self::getCachePath($type), $domainHash);
80 80
         if ($type === self::TYPE_THUMB) {
81
-            $suffix = $width . $height . ($crop ? '1' : '0') .'.jpg';
81
+            $suffix = $width.$height.($crop ? '1' : '0').'.jpg';
82 82
         } else {
83
-            $suffix = $width . $height;
83
+            $suffix = $width.$height;
84 84
         }
85
-        return $domainFolder . self::getThumbFilename($url) . $suffix;
85
+        return $domainFolder.self::getThumbFilename($url).$suffix;
86 86
     }
87 87
 
88 88
     /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     public static function isCacheValid($cacheFile, $domain, $type)
101 101
     {
102 102
         $out = false;
103
-        $cacheDuration = ConfigManager::get('settings.cache_duration', 3600*24*31);
103
+        $cacheDuration = ConfigManager::get('settings.cache_duration', 3600 * 24 * 31);
104 104
 
105 105
         if (is_readable($cacheFile)
106 106
             && ($cacheDuration < 0 || (time() - filemtime($cacheFile)) < $cacheDuration)
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
      */
122 122
     protected static function createDomainThumbCacheFolder($domain, $type)
123 123
     {
124
-        $domainFolder = self::getCachePath($type) . $domain;
124
+        $domainFolder = self::getCachePath($type).$domain;
125 125
         if (!file_exists($domainFolder)) {
126 126
             mkdir($domainFolder, 0775, false);
127
-            touch($domainFolder . '/' . self::$CLEAN_FILE);
127
+            touch($domainFolder.'/'.self::$CLEAN_FILE);
128 128
         }
129 129
     }
130 130
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     protected static function checkCacheType($type)
152 152
     {
153 153
         if ($type != self::TYPE_THUMB && $type != self::TYPE_FINDER) {
154
-            throw new CacheException('Unknown cache type '. $type);
154
+            throw new CacheException('Unknown cache type '.$type);
155 155
         }
156 156
     }
157 157
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
     protected static function rebuildCacheFolders()
162 162
     {
163 163
         $mainFolder = ConfigManager::get('settings.path.cache', 'cache/');
164
-        if (! is_dir($mainFolder)) {
164
+        if (!is_dir($mainFolder)) {
165 165
             mkdir($mainFolder, 0755);
166 166
         }
167
-        if (! is_dir($mainFolder.self::TYPE_THUMB)) {
167
+        if (!is_dir($mainFolder.self::TYPE_THUMB)) {
168 168
             mkdir($mainFolder.self::TYPE_THUMB, 0755);
169 169
         }
170
-        if (! is_readable($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
171
-            touch($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep');
170
+        if (!is_readable($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
171
+            touch($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep');
172 172
         }
173
-        if (! is_dir($mainFolder.self::TYPE_FINDER)) {
174
-            mkdir($mainFolder . self::TYPE_FINDER, 0755);
173
+        if (!is_dir($mainFolder.self::TYPE_FINDER)) {
174
+            mkdir($mainFolder.self::TYPE_FINDER, 0755);
175 175
         }
176
-        if (! is_readable($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
176
+        if (!is_readable($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
177 177
             touch($mainFolder.self::TYPE_FINDER.DIRECTORY_SEPARATOR.'.gitkeep');
178 178
         }
179 179
     }
Please login to merge, or discard this patch.