Completed
Push — master ( c877ec...c350e4 )
by Fran
04:32
created
src/base/Cache.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
      */
30 30
     private function saveTextToFile($data, $path, $absolute = false)
31 31
     {
32
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
32
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
33 33
         $filename = basename($absolutePath);
34 34
         Config::createDir(str_replace($filename, "", $absolutePath));
35 35
         if (false === file_put_contents($absolutePath, $data)) {
36
-            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ') . $absolutePath);
36
+            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ').$absolutePath);
37 37
         }
38 38
     }
39 39
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function getDataFromFile($path, $transform = Cache::TEXT, $absolute = false)
48 48
     {
49 49
         $data = null;
50
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
50
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
51 51
         if (file_exists($absolutePath)) {
52 52
             $data = file_get_contents($absolutePath);
53 53
         }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     private function hasExpiredCache($path, $expires = 300, $absolute = false)
65 65
     {
66
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
66
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
67 67
         $lasModificationDate = filemtime($absolutePath);
68 68
         return ($lasModificationDate + $expires <= time());
69 69
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 break;
87 87
             case Cache::GZIP:
88 88
                 // TODO implementar
89
-                if(function_exists('gzuncompress')) {
89
+                if (function_exists('gzuncompress')) {
90 90
                     $data = gzuncompress($data);
91 91
                 }
92 92
                 break;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 $data = Cache::transformData($data, Cache::GZIP);
112 112
                 break;
113 113
             case Cache::GZIP:
114
-                if(function_exists('gzcompress')) {
114
+                if (function_exists('gzcompress')) {
115 115
                     $data = gzcompress($data);
116 116
                 }
117 117
                 break;
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
     public function readFromCache($path, $expires = 300, callable $function, $transform = Cache::TEXT)
144 144
     {
145 145
         $data = null;
146
-        if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) {
146
+        if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) {
147 147
             if (null !== $function && $this->hasExpiredCache($path, $expires)) {
148 148
                 $data = call_user_func($function);
149 149
                 $this->storeData($path, $data, $transform);
150
-            } else {
150
+            }else {
151 151
                 $data = $this->getDataFromFile($path, $transform);
152 152
             }
153 153
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $hash = "";
178 178
         $action = Security::getInstance()->getSessionKey("__CACHE__");
179 179
         if (null !== $action && $action["cache"] > 0) {
180
-            $hash = $action["http"] . " " . $action["slug"];
180
+            $hash = $action["http"]." ".$action["slug"];
181 181
         }
182 182
         return sha1($hash);
183 183
     }
Please login to merge, or discard this patch.