Passed
Pull Request — master (#7)
by Arthur
01:54
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
     }
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
         self::createDomainThumbCacheFolder($domain, $type);
78 78
         $domainFolder = FileUtils::getPath(self::getCachePath($type), $domain);
79 79
         if ($type === self::TYPE_THUMB) {
80
-            $suffix = $width . $height . ($crop ? '1' : '0') .'.jpg';
80
+            $suffix = $width.$height.($crop ? '1' : '0').'.jpg';
81 81
         } else {
82
-            $suffix = $width . $height;
82
+            $suffix = $width.$height;
83 83
         }
84
-        return $domainFolder . self::getThumbFilename($url) . $suffix;
84
+        return $domainFolder.self::getThumbFilename($url).$suffix;
85 85
     }
86 86
 
87 87
     /**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public static function isCacheValid($cacheFile, $domain, $type)
100 100
     {
101 101
         $out = false;
102
-        $cacheDuration = ConfigManager::get('settings.cache_duration', 3600*24*31);
102
+        $cacheDuration = ConfigManager::get('settings.cache_duration', 3600 * 24 * 31);
103 103
 
104 104
         if (is_readable($cacheFile)
105 105
             && ($cacheDuration < 0 || (time() - filemtime($cacheFile)) < $cacheDuration)
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
      */
121 121
     protected static function createDomainThumbCacheFolder($domain, $type)
122 122
     {
123
-        $domainFolder = self::getCachePath($type) . $domain;
123
+        $domainFolder = self::getCachePath($type).$domain;
124 124
         if (!file_exists($domainFolder)) {
125 125
             mkdir($domainFolder, 0775, false);
126
-            touch($domainFolder . '/' . self::$CLEAN_FILE);
126
+            touch($domainFolder.'/'.self::$CLEAN_FILE);
127 127
         }
128 128
     }
129 129
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     protected static function checkCacheType($type)
151 151
     {
152 152
         if ($type != self::TYPE_THUMB && $type != self::TYPE_FINDER) {
153
-            throw new CacheException('Unknown cache type '. $type);
153
+            throw new CacheException('Unknown cache type '.$type);
154 154
         }
155 155
     }
156 156
 
@@ -160,19 +160,19 @@  discard block
 block discarded – undo
160 160
     protected static function rebuildCacheFolders()
161 161
     {
162 162
         $mainFolder = ConfigManager::get('settings.path.cache', 'cache/');
163
-        if (! is_dir($mainFolder)) {
163
+        if (!is_dir($mainFolder)) {
164 164
             mkdir($mainFolder, 0755);
165 165
         }
166
-        if (! is_dir($mainFolder.self::TYPE_THUMB)) {
166
+        if (!is_dir($mainFolder.self::TYPE_THUMB)) {
167 167
             mkdir($mainFolder.self::TYPE_THUMB, 0755);
168 168
         }
169
-        if (! is_readable($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
170
-            touch($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep');
169
+        if (!is_readable($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
170
+            touch($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep');
171 171
         }
172
-        if (! is_dir($mainFolder.self::TYPE_FINDER)) {
173
-            mkdir($mainFolder . self::TYPE_FINDER, 0755);
172
+        if (!is_dir($mainFolder.self::TYPE_FINDER)) {
173
+            mkdir($mainFolder.self::TYPE_FINDER, 0755);
174 174
         }
175
-        if (! is_readable($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) {
175
+        if (!is_readable($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) {
176 176
             touch($mainFolder.self::TYPE_FINDER.DIRECTORY_SEPARATOR.'.gitkeep');
177 177
         }
178 178
     }
Please login to merge, or discard this patch.