Passed
Push — master ( ab5b91...849dc0 )
by Fran
03:17
created
src/base/types/helpers/Inspector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     {
53 53
         return [
54 54
             'ts' => round($stats['ts'] - $timestamp, 4),
55
-            'mem' => round(($stats['mem'] - $mem) / 1024 / 1024, 4),
55
+            'mem' => round(($stats['mem'] - $mem)/1024/1024, 4),
56 56
             'files' => $stats['files'] - $files,
57 57
             'name' => $stats['name'],
58 58
         ];
Please login to merge, or discard this patch.
src/base/types/helpers/AssetsHelper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,26 +66,26 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return string[]
68 68
      */
69
-    public static function calculateAssetPath(string $string, string|null $name = null, bool $return = true, string $filenamePath = ''): array
69
+    public static function calculateAssetPath(string $string, string | null $name = null, bool $return = true, string $filenamePath = ''): array
70 70
     {
71 71
         $path = explode("/", $string);
72 72
         $originalFilename = end($path);
73
-        $base = WEB_DIR . DIRECTORY_SEPARATOR;
73
+        $base = WEB_DIR.DIRECTORY_SEPARATOR;
74 74
         $debug = Config::getParam('debug');
75 75
         $cache = Config::getParam('cache.var');
76
-        $cache = $cache ? '.' . $cache : '';
76
+        $cache = $cache ? '.'.$cache : '';
77 77
         $finfo = finfo_open(FILEINFO_MIME_TYPE); // devuelve el tipo mime de su extensión
78 78
         $mime = finfo_file($finfo, $filenamePath);
79 79
         $extension = explode(".", $string);
80 80
         $extension = end($extension);
81
-        $file = "/" . substr(md5($string), 0, 8) . "." . $extension;
81
+        $file = "/".substr(md5($string), 0, 8).".".$extension;
82 82
         $htmlBase = '';
83 83
         finfo_close($finfo);
84 84
         if (preg_match('/\.css$/i', $string)) {
85
-            $file = "/" . substr(md5($string), 0, 8) . "$cache.css";
85
+            $file = "/".substr(md5($string), 0, 8)."$cache.css";
86 86
             $htmlBase = "css";
87 87
         } elseif (preg_match('/\.js$/i', $string)) {
88
-            $file = "/" . substr(md5($string), 0, 8) . "$cache.js";
88
+            $file = "/".substr(md5($string), 0, 8)."$cache.js";
89 89
             $htmlBase = "js";
90 90
         } elseif (preg_match("/image/i", $mime)) {
91 91
             $htmlBase = "img";
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
             $file = $name;
100 100
         }
101 101
         if ($debug) {
102
-            $file = str_replace("." . $extension, "_" . $originalFilename, $file);
102
+            $file = str_replace(".".$extension, "_".$originalFilename, $file);
103 103
         }
104
-        $filePath = $htmlBase . $file;
104
+        $filePath = $htmlBase.$file;
105 105
 
106 106
         return array($base, $htmlBase, $filePath);
107 107
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     {
117 117
         GeneratorHelper::createDir(dirname($path));
118 118
         if ("" !== $content && false === file_put_contents($path, $content)) {
119
-            throw new ConfigException(t('No se tienen permisos para escribir en ' . $path));
119
+            throw new ConfigException(t('No se tienen permisos para escribir en '.$path));
120 120
         }
121 121
     }
122 122
 }
Please login to merge, or discard this patch.
src/base/types/helpers/ResponseHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
             Logger::log('Adding debug headers to render response');
77 77
             $vars["__DEBUG__"]["includes"] = get_included_files();
78 78
             $vars["__DEBUG__"]["trace"] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
79
-            header('X-PSFS-DEBUG-TS: ' . Dispatcher::getInstance()->getTs() . ' s');
80
-            header('X-PSFS-DEBUG-MEM: ' . Dispatcher::getInstance()->getMem('MBytes') . ' MBytes');
81
-            header('X-PSFS-DEBUG-FILES: ' . count(get_included_files()) . ' files opened');
79
+            header('X-PSFS-DEBUG-TS: '.Dispatcher::getInstance()->getTs().' s');
80
+            header('X-PSFS-DEBUG-MEM: '.Dispatcher::getInstance()->getMem('MBytes').' MBytes');
81
+            header('X-PSFS-DEBUG-FILES: '.count(get_included_files()).' files opened');
82 82
         }
83 83
 
84 84
         return $vars;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @return int|string
91 91
      * @throws GeneratorException
92 92
      */
93
-    public static function httpNotFound(Exception $exception = NULL, bool $isJson = false): int|string
93
+    public static function httpNotFound(Exception $exception = NULL, bool $isJson = false): int | string
94 94
     {
95 95
         if (self::isTest()) {
96 96
             return 404;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $notFoundRoute = Config::getParam('route.404');
110 110
         if (null !== $notFoundRoute) {
111 111
             Request::getInstance()->redirect(Router::getInstance()->getRoute($notFoundRoute, true));
112
-        } else {
112
+        }else {
113 113
             return $template->render('error.html.twig', array(
114 114
                 'exception' => $exception,
115 115
                 'trace' => $exception->getTraceAsString(),
Please login to merge, or discard this patch.
src/base/config/Config.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     protected function init()
99 99
     {
100
-        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) {
100
+        if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) {
101 101
             $this->loadConfigData();
102 102
         }
103 103
         return $this;
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
         $finalData = self::saveExtraParams($data);
213 213
         $saved = false;
214 214
         try {
215
-            $finalData = array_filter($finalData, function ($key, $value) {
215
+            $finalData = array_filter($finalData, function($key, $value) {
216 216
                 return in_array($key, self::$required, true) || !empty($value);
217 217
             }, ARRAY_FILTER_USE_BOTH);
218
-            $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($finalData, JSON_PRETTY_PRINT)));
218
+            $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($finalData, JSON_PRETTY_PRINT)));
219 219
             self::getInstance()->loadConfigData();
220 220
             $saved = true;
221
-        } catch (ConfigException $e) {
221
+        }catch (ConfigException $e) {
222 222
             Logger::log($e->getMessage(), LOG_ERR);
223 223
         }
224 224
         return $saved;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public function loadConfigData()
252 252
     {
253
-        $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: [];
253
+        $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: [];
254 254
         $this->debug = array_key_exists('debug', $this->config) ? (bool)$this->config['debug'] : FALSE;
255 255
         if (array_key_exists('cache.var', $this->config)) {
256 256
             Security::getInstance()->setSessionKey('config.cache.var', $this->config['cache.var']);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     public static function getParam($key, $defaultValue = null, $module = null)
276 276
     {
277 277
         if (null !== $module) {
278
-            return self::getParam(strtolower($module) . '.' . $key, self::getParam($key, $defaultValue));
278
+            return self::getParam(strtolower($module).'.'.$key, self::getParam($key, $defaultValue));
279 279
         }
280 280
         $param = self::getInstance()->get($key);
281 281
         return (null !== $param) ? $param : $defaultValue;
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
     {
292 292
         $done = true;
293 293
         foreach (self::$cleanable_config_files as $configFile) {
294
-            if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . $configFile)) {
295
-                if (!unlink(CONFIG_DIR . DIRECTORY_SEPARATOR . $configFile)) {
294
+            if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.$configFile)) {
295
+                if (!unlink(CONFIG_DIR.DIRECTORY_SEPARATOR.$configFile)) {
296 296
                     $done = false;
297 297
                 }
298 298
             }
Please login to merge, or discard this patch.
src/base/extension/TemplateFunctions.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 
47 47
         $filePath = '';
48 48
         if (!file_exists($filePath)) {
49
-            $filePath = BASE_DIR . $string;
49
+            $filePath = BASE_DIR.$string;
50 50
         }
51 51
         $filenamePath = AssetsHelper::findDomainPath($string, $filePath);
52 52
 
53 53
         $filePath = self::processAsset($string, $name, $return, $filenamePath);
54 54
         $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl());
55
-        $returnPath = empty($name) ? $basePath . '/' . $filePath : $name;
55
+        $returnPath = empty($name) ? $basePath.'/'.$filePath : $name;
56 56
         return $return ? $returnPath : '';
57 57
     }
58 58
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $router = Router::getInstance();
70 70
         try {
71 71
             return $router->getRoute($path, $absolute, $params);
72
-        } catch (\Exception $e) {
72
+        }catch (\Exception $e) {
73 73
             Logger::log($e->getMessage());
74 74
             return $router->getRoute('', $absolute, $params);
75 75
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         $filenamePath = self::extractPathname($path, $domains);
166 166
         // Check if resources has been copied to public folders
167 167
         if (!$debug) {
168
-            $cacheFilename = Config::getParam('cache.var', '__initial__') . '.file.cache';
168
+            $cacheFilename = Config::getParam('cache.var', '__initial__').'.file.cache';
169 169
             $cachedFiles = Cache::getInstance()->readFromCache($cacheFilename,
170 170
                 1, fn() => [], Cache::JSON, true) ?: [];
171 171
             // Force the resource copy
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      *
187 187
      * @return string|array
188 188
      */
189
-    private static function extractPathname(string $path, $domains): string|array
189
+    private static function extractPathname(string $path, $domains): string | array
190 190
     {
191 191
         $filenamePath = $path;
192 192
         if (!empty($domains) && !file_exists($path)) {
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
      * @param string $base
226 226
      * @param string $filePath
227 227
      */
228
-    private static function putResourceContent(string|null $name, string $filenamePath, string $base, string $filePath): void
228
+    private static function putResourceContent(string | null $name, string $filenamePath, string $base, string $filePath): void
229 229
     {
230 230
         $data = file_get_contents($filenamePath);
231 231
         if (!empty($name)) {
232
-            file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data);
233
-        } else {
234
-            file_put_contents($base . $filePath, $data);
232
+            file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data);
233
+        }else {
234
+            file_put_contents($base.$filePath, $data);
235 235
         }
236 236
     }
237 237
 
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
      * @return string
245 245
      * @throws GeneratorException
246 246
      */
247
-    private static function processAsset(string $string, string|null $name = null, bool $return = true, string $filenamePath = ''): string
247
+    private static function processAsset(string $string, string | null $name = null, bool $return = true, string $filenamePath = ''): string
248 248
     {
249 249
         $filePath = $filenamePath;
250 250
         if (file_exists($filenamePath)) {
251 251
             list($base, $htmlBase, $filePath) = AssetsHelper::calculateAssetPath($string, $name, $return, $filenamePath);
252 252
             //Creamos el directorio si no existe
253
-            GeneratorHelper::createDir($base . $htmlBase);
253
+            GeneratorHelper::createDir($base.$htmlBase);
254 254
             //Si se ha modificado
255
-            if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) {
255
+            if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($filenamePath)) {
256 256
                 if ($htmlBase === 'css') {
257 257
                     self::processCssLines($filenamePath);
258 258
                 }
Please login to merge, or discard this patch.
src/base/dto/Dto.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
                             }
58 58
                         }
59 59
                         $dto[$property->getName()] = $value;
60
-                    } else {
60
+                    }else {
61 61
                         $type = InjectorHelper::extractVarType($property->getDocComment());
62 62
                         $dto[$property->getName()] = $this->checkCastedValue($property->getValue($this), $type);
63 63
                     }
64 64
                 }
65 65
             }
66
-        } catch (\Exception $e) {
67
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
66
+        }catch (\Exception $e) {
67
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
68 68
         }
69 69
         return $dto;
70 70
     }
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
                             $this->$key[] = $dto;
102 102
                         }
103 103
                     }
104
-                } else {
104
+                }else {
105 105
                     $this->$key = clone $this->__cache[$type];
106 106
                     $this->$key->fromArray($value);
107 107
                 }
108 108
             }
109
-        } else {
109
+        }else {
110 110
             $this->castValue($key, $value, $type);
111 111
         }
112 112
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     /**
134 134
      * @return mixed
135 135
      */
136
-    public function jsonSerialize(): array|string|null
136
+    public function jsonSerialize(): array | string | null
137 137
     {
138 138
         return $this->toArray();
139 139
     }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                     $value = (bool)$rawValue;
193 193
                     break;
194 194
             }
195
-        } else {
195
+        }else {
196 196
             $value = $rawValue;
197 197
         }
198 198
         return $value;
Please login to merge, or discard this patch.