Test Failed
Push — master ( 79af4d...00f9a5 )
by Fran
02:26
created
src/controller/DocumentorController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
      */
70 70
     public function swaggerUi($domain)
71 71
     {
72
-        if(!Router::getInstance()->domainExists($domain)) {
72
+        if (!Router::getInstance()->domainExists($domain)) {
73 73
             throw new RouterException('Domains is empty');
74 74
         }
75 75
         return $this->render('swagger.html.twig', [
Please login to merge, or discard this patch.
src/controller/base/Admin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@
 block discarded – undo
38 38
         if (self::isTest()) {
39 39
             throw new UserAuthException();
40 40
         }
41
-        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json')) {
41
+        if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json')) {
42 42
             return AdminServices::getInstance()->setAdminHeaders();
43
-        } else {
43
+        }else {
44 44
             return UserController::showAdminManager();
45 45
         }
46 46
     }
Please login to merge, or discard this patch.
src/controller/UserController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                 Logger::log('Configuration saved successful');
66 66
                 Security::getInstance()->setFlash("callback_message", t("Usuario agregado correctamente"));
67 67
                 Security::getInstance()->setFlash("callback_route", Router::getInstance()->getRoute("admin", true));
68
-            } else {
68
+            }else {
69 69
                 throw new ConfigException(t('Error al guardar los administradores, prueba a cambiar los permisos'));
70 70
             }
71 71
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         if ($this->isAdmin()) {
101 101
             $this->redirect('admin');
102
-        } else {
102
+        }else {
103 103
             return Admin::staticAdminLogon();
104 104
         }
105 105
     }
Please login to merge, or discard this patch.
src/base/Router.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function init()
73 73
     {
74
-        list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', $this->cacheType, TRUE);
75
-        $this->domains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', $this->cacheType, TRUE);
74
+        list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', $this->cacheType, TRUE);
75
+        $this->domains = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', $this->cacheType, TRUE);
76 76
         if (empty($this->routing) || Config::getParam('debug', true)) {
77 77
             $this->debugLoad();
78 78
         }
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
         try {
139 139
             //Search action and execute
140 140
             return $this->searchAction($route);
141
-        } catch (AccessDeniedException $e) {
142
-            Logger::log(t('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile() . '[' . $e->getLine() . ']']);
141
+        }catch (AccessDeniedException $e) {
142
+            Logger::log(t('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile().'['.$e->getLine().']']);
143 143
             return Admin::staticAdminLogon();
144
-        } catch (RouterException $r) {
144
+        }catch (RouterException $r) {
145 145
             Logger::log($r->getMessage(), LOG_WARNING);
146 146
             $code = $r->getCode();
147
-        } catch (Exception $e) {
147
+        }catch (Exception $e) {
148 148
             Logger::log($e->getMessage(), LOG_ERR);
149 149
             throw $e;
150 150
         }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     protected function searchAction($route)
164 164
     {
165
-        Inspector::stats('[Router] Searching action to execute: ' . $route, Inspector::SCOPE_DEBUG);
165
+        Inspector::stats('[Router] Searching action to execute: '.$route, Inspector::SCOPE_DEBUG);
166 166
         //Revisamos si tenemos la ruta registrada
167 167
         $parts = parse_url($route);
168 168
         $path = array_key_exists('path', $parts) ? $parts['path'] : $route;
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
                 try {
180 180
                     if ($this->checkRequirements($action, $get)) {
181 181
                         return $this->executeCachedRoute($route, $action, $class, $get);
182
-                    } else {
182
+                    }else {
183 183
                         throw new RouterException(t('Preconditions failed'), 412);
184 184
                     }
185
-                } catch (Exception $e) {
185
+                }catch (Exception $e) {
186 186
                     Logger::log($e->getMessage(), LOG_ERR);
187 187
                     throw $e;
188 188
                 }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                 }
208 208
             }
209 209
             $valid = count($action['requirements']) === $checked;
210
-        } else {
210
+        }else {
211 211
             $valid = true;
212 212
         }
213 213
         return $valid;
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
             if ($modules->hasResults()) {
255 255
                 foreach ($modules->getIterator() as $modulePath) {
256 256
                     $module = $modulePath->getBasename();
257
-                    $this->routing = $this->inspectDir($modulesPath . DIRECTORY_SEPARATOR . $module, $module, $this->routing);
257
+                    $this->routing = $this->inspectDir($modulesPath.DIRECTORY_SEPARATOR.$module, $module, $this->routing);
258 258
                 }
259 259
             }
260 260
         }
261
-        $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', $this->domains, Cache::JSON, TRUE);
261
+        $this->cache->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', $this->domains, Cache::JSON, TRUE);
262 262
     }
263 263
 
264 264
     /**
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             $homeParams = NULL;
276 276
             foreach ($this->routing as $pattern => $params) {
277 277
                 list($method, $route) = RouterHelper::extractHttpRoute($pattern);
278
-                if (preg_match('/' . preg_quote($route, '/') . '$/i', '/' . $home)) {
278
+                if (preg_match('/'.preg_quote($route, '/').'$/i', '/'.$home)) {
279 279
                     $homeParams = $params;
280 280
                 }
281 281
                 unset($method);
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     {
304 304
         $this->generateSlugs();
305 305
         GeneratorHelper::createDir(CONFIG_DIR);
306
-        Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', array($this->routing, $this->slugs), Cache::JSON, TRUE);
306
+        Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', array($this->routing, $this->slugs), Cache::JSON, TRUE);
307 307
 
308 308
         return $this;
309 309
     }
@@ -320,18 +320,18 @@  discard block
 block discarded – undo
320 320
     {
321 321
         $baseUrl = $absolute ? Request::getInstance()->getRootUrl() : '';
322 322
         if ('' === $slug) {
323
-            return $baseUrl . '/';
323
+            return $baseUrl.'/';
324 324
         }
325 325
         if (!is_array($this->slugs) || !array_key_exists($slug, $this->slugs)) {
326 326
             throw new RouterException(t('No existe la ruta especificada'));
327 327
         }
328
-        $url = $baseUrl . $this->slugs[$slug];
328
+        $url = $baseUrl.$this->slugs[$slug];
329 329
         if (!empty($params)) {
330 330
             foreach ($params as $key => $value) {
331
-                $url = str_replace('{' . $key . '}', $value, $url);
331
+                $url = str_replace('{'.$key.'}', $value, $url);
332 332
             }
333 333
         } elseif (!empty($this->routing[$this->slugs[$slug]]['default'])) {
334
-            $url = $baseUrl . $this->routing[$this->slugs[$slug]]['default'];
334
+            $url = $baseUrl.$this->routing[$this->slugs[$slug]]['default'];
335 335
         }
336 336
 
337 337
         return preg_replace('/(GET|POST|PUT|DELETE|ALL|HEAD|PATCH)\#\|\#/', '', $url);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      */
344 344
     private function checkPreActions($class, $method)
345 345
     {
346
-        $preAction = 'pre' . ucfirst($method);
346
+        $preAction = 'pre'.ucfirst($method);
347 347
         if (method_exists($class, $preAction)) {
348 348
             Inspector::stats('[Router] Pre action invoked', Inspector::SCOPE_DEBUG);
349 349
             try {
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                     Logger::log(t('Pre action failed'), LOG_ERR, [error_get_last()]);
352 352
                     error_clear_last();
353 353
                 }
354
-            } catch (Exception $e) {
354
+            }catch (Exception $e) {
355 355
                 Logger::log($e->getMessage(), LOG_ERR, [$class, $method]);
356 356
             }
357 357
         }
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
      */
369 369
     protected function executeCachedRoute($route, $action, $class, $params = NULL)
370 370
     {
371
-        Inspector::stats('[Router] Executing route ' . $route, Inspector::SCOPE_DEBUG);
371
+        Inspector::stats('[Router] Executing route '.$route, Inspector::SCOPE_DEBUG);
372 372
         $action['params'] = array_merge($action['params'], $params, Request::getInstance()->getQueryParams());
373 373
         Security::getInstance()->setSessionKey(Cache::CACHE_SESSION_VAR, $action);
374 374
         $cache = Cache::needCache();
@@ -376,15 +376,15 @@  discard block
 block discarded – undo
376 376
         $return = null;
377 377
         if (FALSE !== $cache && $action['http'] === 'GET' && Config::getParam('debug') === FALSE) {
378 378
             list($path, $cacheDataName) = $this->cache->getRequestCacheHash();
379
-            $cachedData = $this->cache->readFromCache('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName, $cache);
379
+            $cachedData = $this->cache->readFromCache('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName, $cache);
380 380
             if (NULL !== $cachedData) {
381
-                $headers = $this->cache->readFromCache('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName . '.headers', $cache, null, Cache::JSON);
381
+                $headers = $this->cache->readFromCache('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName.'.headers', $cache, null, Cache::JSON);
382 382
                 Template::getInstance()->renderCache($cachedData, $headers);
383 383
                 $execute = FALSE;
384 384
             }
385 385
         }
386 386
         if ($execute) {
387
-            Inspector::stats('[Router] Start executing action ' . $route, Inspector::SCOPE_DEBUG);
387
+            Inspector::stats('[Router] Start executing action '.$route, Inspector::SCOPE_DEBUG);
388 388
             $this->checkPreActions($class, $action['method']);
389 389
             $return = call_user_func_array([$class, $action['method']], $params);
390 390
             if (false === $return) {
Please login to merge, or discard this patch.
src/base/types/helpers/ResponseHelper.php 1 patch
Spacing   +6 added lines, -6 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;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public static function httpNotFound(Exception $exception = NULL, $isJson = false)
95 95
     {
96
-        if(self::isTest()) {
96
+        if (self::isTest()) {
97 97
             return 404;
98 98
         }
99 99
         Inspector::stats('[Router] Throw not found exception', Inspector::SCOPE_DEBUG);
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         $notFoundRoute = Config::getParam('route.404');
111
-        if(null !== $notFoundRoute) {
111
+        if (null !== $notFoundRoute) {
112 112
             Request::getInstance()->redirect(Router::getInstance()->getRoute($notFoundRoute, true));
113
-        } else {
113
+        }else {
114 114
             return $template->render('error.html.twig', array(
115 115
                 'exception' => $exception,
116 116
                 'trace' => $exception->getTraceAsString(),
Please login to merge, or discard this patch.
src/base/types/helpers/RouterHelper.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
     {
25 25
         Inspector::stats('[RouterHelper] Getting class to call for executing the request action', Inspector::SCOPE_DEBUG);
26 26
         Logger::log('Getting class to call for executing the request action', LOG_DEBUG, $action);
27
-        $actionClass = class_exists($action['class']) ? $action['class'] : "\\" . $action['class'];
27
+        $actionClass = class_exists($action['class']) ? $action['class'] : "\\".$action['class'];
28 28
         $reflectionClass = new ReflectionClass($actionClass);
29 29
         if ($reflectionClass->hasMethod('getInstance')) {
30 30
             $class = $reflectionClass->getMethod('getInstance')->invoke(null, $action['method']);
31
-        } else {
31
+        }else {
32 32
             $class = new $actionClass;
33 33
         }
34 34
         return $class;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public static function extractComponents($route, $pattern)
63 63
     {
64 64
         Inspector::stats('[RouterHelper] Extracting parts for the request to execute', Inspector::SCOPE_DEBUG);
65
-        if(Config::getParam('allow.double.slashes', true)) {
65
+        if (Config::getParam('allow.double.slashes', true)) {
66 66
             $route = preg_replace("/\/\//", '/', $route);
67 67
         }
68 68
         $url = parse_url($route);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $expr = preg_quote($expr, '/');
121 121
         $expr = str_replace('###', '(.*)', $expr);
122 122
         $expr2 = preg_replace('/\(\.\*\)$/', '', $expr);
123
-        $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path);
123
+        $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path);
124 124
         return $matched;
125 125
     }
126 126
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public static function extractDomainInfo(ReflectionClass $class, $domain)
133 133
     {
134
-        $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
134
+        $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
135 135
         $templatesPath = 'templates';
136 136
         $publicPath = 'public';
137 137
         $modelsPath = 'models';
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
             $modelsPath = ucfirst($modelsPath);
142 142
         }
143 143
         if ($class->hasConstant('TPL')) {
144
-            $templatesPath .= DIRECTORY_SEPARATOR . $class->getConstant('TPL');
144
+            $templatesPath .= DIRECTORY_SEPARATOR.$class->getConstant('TPL');
145 145
         }
146 146
         return [
147 147
             'base' => $path,
148
-            'template' => $path . $templatesPath,
149
-            'model' => $path . $modelsPath,
150
-            'public' => $path . $publicPath,
148
+            'template' => $path.$templatesPath,
149
+            'model' => $path.$modelsPath,
150
+            'public' => $path.$publicPath,
151 151
         ];
152 152
     }
153 153
 
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
             foreach ($parameters as $param) {
169 169
                 if ($param->isOptional() && !is_array($param->getDefaultValue())) {
170 170
                     $params[$param->getName()] = $param->getDefaultValue();
171
-                    $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex);
171
+                    $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue(), $regex);
172 172
                 } elseif (!$param->isOptional()) {
173 173
                     $requirements[] = $param->getName();
174 174
                 }
175 175
             }
176
-        } else {
176
+        }else {
177 177
             $default = $regex;
178 178
         }
179 179
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             $httpMethod = AnnotationHelper::extractReflectionHttpMethod($docComments);
204 204
             $icon = AnnotationHelper::extractDocIcon($docComments);
205 205
             $label = AnnotationHelper::extractReflectionLabel(str_replace('{__API__}', $api, $docComments));
206
-            $route = $httpMethod . "#|#" . $regex;
206
+            $route = $httpMethod."#|#".$regex;
207 207
             $route = preg_replace('/(\\r|\\f|\\t|\\n)/', '', $route);
208 208
             $info = [
209 209
                 'method' => $method->getName(),
Please login to merge, or discard this patch.
src/base/types/traits/Router/ModulesTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
         if ($files->hasResults()) {
53 53
             foreach ($files->getIterator() as $file) {
54 54
                 if ($namespace !== Router::PSFS_BASE_NAMESPACE && method_exists($file, 'getRelativePathname')) {
55
-                    $filename = '\\' . str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname()));
56
-                } else {
55
+                    $filename = '\\'.str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname()));
56
+                }else {
57 57
                     $filename = str_replace('/', '\\', str_replace($origen, '', $file->getPathname()));
58 58
                 }
59
-                $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing, $namespace);
59
+                $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing, $namespace);
60 60
             }
61 61
         }
62 62
         $this->initializeFinder();
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             if (!is_array($this->domains)) {
110 110
                 $this->domains = [];
111 111
             }
112
-            $domain = '@' . $class->getConstant('DOMAIN') . '/';
112
+            $domain = '@'.$class->getConstant('DOMAIN').'/';
113 113
             if (!array_key_exists($domain, $this->domains)) {
114 114
                 $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain);
115 115
             }
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
     private function loadExternalAutoloader($hydrateRoute, SplFileInfo $modulePath, $externalModulePath, &$routing = [])
137 137
     {
138 138
         $extModule = $modulePath->getBasename();
139
-        $moduleAutoloader = realpath($externalModulePath . DIRECTORY_SEPARATOR . $extModule . DIRECTORY_SEPARATOR . 'autoload.php');
139
+        $moduleAutoloader = realpath($externalModulePath.DIRECTORY_SEPARATOR.$extModule.DIRECTORY_SEPARATOR.'autoload.php');
140 140
         if (file_exists($moduleAutoloader)) {
141 141
             include_once $moduleAutoloader;
142 142
             if ($hydrateRoute) {
143
-                $routing = $this->inspectDir($externalModulePath . DIRECTORY_SEPARATOR . $extModule, '\\' . $extModule, $routing);
143
+                $routing = $this->inspectDir($externalModulePath.DIRECTORY_SEPARATOR.$extModule, '\\'.$extModule, $routing);
144 144
             }
145 145
         }
146 146
     }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         try {
157 157
             $module = preg_replace('/(\\\|\/)/', DIRECTORY_SEPARATOR, $module);
158
-            $externalModulePath = VENDOR_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'src';
158
+            $externalModulePath = VENDOR_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'src';
159 159
             if (file_exists($externalModulePath)) {
160 160
                 $externalModule = $this->finder->directories()->in($externalModulePath)->depth(0);
161 161
                 if ($externalModule->hasResults()) {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                     }
165 165
                 }
166 166
             }
167
-        } catch (Exception $e) {
167
+        }catch (Exception $e) {
168 168
             Logger::log($e->getMessage(), LOG_WARNING);
169 169
         }
170 170
     }
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
     public function domainExists($domainToCheck) {
177 177
         $exists = false;
178 178
         $domains = array_keys($this->getDomains());
179
-        foreach($domains as $domain) {
179
+        foreach ($domains as $domain) {
180 180
             $cleanDomain = strtolower(str_replace('@', '', $domain));
181
-            if($cleanDomain === strtolower($domainToCheck)) {
181
+            if ($cleanDomain === strtolower($domainToCheck)) {
182 182
                 $exists = true;
183 183
                 break;
184 184
             }
Please login to merge, or discard this patch.