Passed
Push — master ( 5b4546...2dd92a )
by Fran
09:27
created
src/base/types/helpers/FileHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public static function readFile($path) {
23 23
         $data = false;
24
-        if(file_exists($path)) {
24
+        if (file_exists($path)) {
25 25
             $data = file_get_contents($path);
26 26
         }
27 27
         return $data;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * @return string
35 35
      */
36 36
     public static function generateHashFilename($verb, $slug, array $query = []) {
37
-        return sha1($verb . " " . $slug . " " . http_build_query($query));
37
+        return sha1($verb." ".$slug." ".http_build_query($query));
38 38
     }
39 39
 
40 40
     /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public static function generateCachePath(array $action, array $query = []) {
46 46
         $class = GeneratorHelper::extractClassFromNamespace($action['class']);
47 47
         $filename = self::generateHashFilename($action["http"], $action["slug"], $query);
48
-        $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2);
49
-        return $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR;
48
+        $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2);
49
+        return $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR;
50 50
     }
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
src/base/Cache.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         GeneratorHelper::createDir(dirname($path));
47 47
         if (false === FileHelper::writeFile($path, $data)) {
48
-            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ') . $path);
48
+            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ').$path);
49 49
         }
50 50
     }
51 51
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function getDataFromFile($path, $transform = Cache::TEXT, $absolute = false)
60 60
     {
61 61
         $data = null;
62
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
62
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
63 63
         if (file_exists($absolutePath)) {
64 64
             $data = FileHelper::readFile($absolutePath);
65 65
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     private function hasExpiredCache($path, $expires = 300, $absolute = false)
77 77
     {
78
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
78
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
79 79
         $lasModificationDate = filemtime($absolutePath);
80 80
         return ($lasModificationDate + $expires <= time());
81 81
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     public function storeData($path, $data, $transform = Cache::TEXT, $absolute = false, $expires = 600)
142 142
     {
143 143
         $data = Cache::transformData($data, $transform);
144
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
144
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
145 145
         $this->saveTextToFile($data, $absolutePath);
146 146
     }
147 147
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
     public function readFromCache($path, $expires = 300, callable $function, $transform = Cache::TEXT)
157 157
     {
158 158
         $data = null;
159
-        if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) {
159
+        if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) {
160 160
             if (null !== $function && $this->hasExpiredCache($path, $expires)) {
161 161
                 $data = call_user_func($function);
162 162
                 $this->storeData($path, $data, $transform, false, $expires);
163
-            } else {
163
+            }else {
164 164
                 $data = $this->getDataFromFile($path, $transform);
165 165
             }
166 166
         }
Please login to merge, or discard this patch.