Completed
Push — master ( e4227f...5cbf20 )
by Fran
03:34
created
src/base/Cache.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
 
108 108
         /**
109 109
          * Método que guarda en fichero los datos pasados
110
-         * @param $path
110
+         * @param string $path
111 111
          * @param $data
112 112
          * @param int $transform
113 113
          * @param boolean $absolutePath
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
                 if (null !== $function && $this->hasExpiredCache($path, $expires)) {
132 132
                     $data = call_user_func($function);
133 133
                     $this->storeData($path, $data, $transform);
134
-                } else {
134
+                }else {
135 135
                     $data = $this->getDataFromFile($path, $transform);
136 136
                 }
137 137
             }
Please login to merge, or discard this patch.
src/base/extension/TemplateFunctions.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
          * Método que copia los recursos recursivamente
131 131
          * @param string $dest
132 132
          * @param boolean $force
133
-         * @param $filename_path
133
+         * @param string $filename_path
134 134
          * @param boolean $debug
135 135
          */
136 136
         private static function copyResources($dest, $force, $filename_path, $debug)
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
          * @param string $path
156 156
          * @param $domains
157 157
          *
158
-         * @return mixed
158
+         * @return string
159 159
          */
160 160
         private static function extractPathname($path, $domains)
161 161
         {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
             $router = Router::getInstance();
53 53
             try {
54 54
                 return $router->getRoute($path, $absolute, $params);
55
-            } catch (\Exception $e)
55
+            }catch (\Exception $e)
56 56
             {
57 57
                 return $router->getRoute('', $absolute, $params);
58 58
             }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                     if (is_dir($filename_path)) {
142 142
                         Config::createDir(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
143 143
                         Template::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
144
-                    }else {
144
+                    } else {
145 145
                         if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
146 146
                             throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
147 147
                         }
@@ -198,8 +198,11 @@  discard block
 block discarded – undo
198 198
         private static function putResourceContent($name, $filename_path, $base, $file_path)
199 199
         {
200 200
             $data = file_get_contents($filename_path);
201
-            if (!empty($name)) file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data);
202
-            else file_put_contents($base.$file_path, $data);
201
+            if (!empty($name)) {
202
+                file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data);
203
+            } else {
204
+                file_put_contents($base.$file_path, $data);
205
+            }
203 206
         }
204 207
 
205 208
         /**
Please login to merge, or discard this patch.
src/base/Request.php 3 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,6 +95,10 @@  discard block
 block discarded – undo
95 95
      * @return string|null
96 96
      */
97 97
     public static function header($name) { return self::getInstance()->getHeader($name); }
98
+
99
+    /**
100
+     * @return string
101
+     */
98 102
     public function getHeader($name)
99 103
     {
100 104
         $header = null;
@@ -107,7 +111,7 @@  discard block
 block discarded – undo
107 111
 
108 112
     /**
109 113
      * Método que devuelve la url solicitada
110
-     * @return string|null
114
+     * @return string
111 115
      */
112 116
     public static function requestUri(){ return self::getInstance()->getRequestUri(); }
113 117
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 
5 5
 use PSFS\base\types\SingletonTrait;
6 6
 
7
-if(!function_exists("getallheaders"))
7
+if (!function_exists("getallheaders"))
8 8
 {
9 9
     function getallheaders()
10 10
     {
11 11
         $headers = array();
12
-        foreach($_SERVER as $h=>$v)
13
-            if(preg_match('/HTTP_(.+)/',$h,$hp))
14
-                $headers[$hp[1]]=$v;
12
+        foreach ($_SERVER as $h=>$v)
13
+            if (preg_match('/HTTP_(.+)/', $h, $hp))
14
+                $headers[$hp[1]] = $v;
15 15
         return $headers;
16 16
     }
17 17
 }
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
      * Método que devuelve la url solicitada
110 110
      * @return string|null
111 111
      */
112
-    public static function requestUri(){ return self::getInstance()->getRequestUri(); }
112
+    public static function requestUri() { return self::getInstance()->getRequestUri(); }
113 113
 
114 114
     /**
115 115
      * @return string
116 116
      */
117
-    public function getRequestUri(){ return array_key_exists('REQUEST_URI', $this->server) ? $this->server['REQUEST_URI'] : ''; }
117
+    public function getRequestUri() { return array_key_exists('REQUEST_URI', $this->server) ? $this->server['REQUEST_URI'] : ''; }
118 118
 
119 119
     /**
120 120
      * Método que devuelve el idioma de la petición
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,9 +9,10 @@  discard block
 block discarded – undo
9 9
     function getallheaders()
10 10
     {
11 11
         $headers = array();
12
-        foreach($_SERVER as $h=>$v)
13
-            if(preg_match('/HTTP_(.+)/',$h,$hp))
12
+        foreach($_SERVER as $h=>$v) {
13
+                    if(preg_match('/HTTP_(.+)/',$h,$hp))
14 14
                 $headers[$hp[1]]=$v;
15
+        }
15 16
         return $headers;
16 17
     }
17 18
 }
@@ -180,7 +181,9 @@  discard block
 block discarded – undo
180 181
      */
181 182
     public function redirect($url = null)
182 183
     {
183
-        if (null === $url) $url = $this->server['HTTP_ORIGIN'];
184
+        if (null === $url) {
185
+            $url = $this->server['HTTP_ORIGIN'];
186
+        }
184 187
         ob_start();
185 188
         header('Location: '.$url);
186 189
         ob_end_clean();
@@ -226,7 +229,9 @@  discard block
 block discarded – undo
226 229
         $host = $this->getServerName();
227 230
         $protocol = $protocol ? $this->getProtocol() : '';
228 231
         $url = '';
229
-        if (!empty($host) && !empty($protocol)) $url = $protocol.$host;
232
+        if (!empty($host) && !empty($protocol)) {
233
+            $url = $protocol.$host;
234
+        }
230 235
         return $url;
231 236
     }
232 237
 
Please login to merge, or discard this patch.
src/base/Router.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         /**
589 589
          * Método que extrae los parámetros de una función
590 590
          *
591
-         * @param array $sr
591
+         * @param string[] $sr
592 592
          * @param \ReflectionMethod $method
593 593
          *
594 594
          * @return array
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
          *
643 643
          * @param string $docComments
644 644
          *
645
-         * @return bool
645
+         * @return string
646 646
          */
647 647
         private function extractReflectionCacheability($docComments)
648 648
         {
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -260,8 +260,10 @@  discard block
 block discarded – undo
260 260
             $_route = explode("/", $url['path']);
261 261
             $_pattern = explode("/", $pattern);
262 262
             $get = array();
263
-            if (!empty($_pattern)) foreach ($_pattern as $index => $component) {
263
+            if (!empty($_pattern)) {
264
+                foreach ($_pattern as $index => $component) {
264 265
                 $_get = array();
266
+            }
265 267
                 preg_match_all('/^\{(.*)\}$/i', $component, $_get);
266 268
                 if (!empty($_get[1]) && isset($_route[$index])) {
267 269
                     $get[array_pop($_get[1])] = $_route[$index];
@@ -476,8 +478,10 @@  discard block
 block discarded – undo
476 478
                 throw new RouterException(_("No existe la ruta especificada"));
477 479
             }
478 480
             $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug];
479
-            if (!empty($params)) foreach ($params as $key => $value) {
481
+            if (!empty($params)) {
482
+                foreach ($params as $key => $value) {
480 483
                 $url = str_replace("{" . $key . "}", $value, $url);
484
+            }
481 485
             } elseif (!empty($this->routing[$this->slugs[$slug]]["default"])) {
482 486
                 $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
483 487
             }
@@ -599,12 +603,16 @@  discard block
 block discarded – undo
599 603
             $default = '';
600 604
             $params = array();
601 605
             $parameters = $method->getParameters();
602
-            if (count($parameters) > 0) foreach ($parameters as $param) {
606
+            if (count($parameters) > 0) {
607
+                foreach ($parameters as $param) {
603 608
                 if ($param->isOptional() && !is_array($param->getDefaultValue())) {
604 609
                     $params[$param->getName()] = $param->getDefaultValue();
610
+            }
605 611
                     $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex);
606 612
                 }
607
-            } else $default = $regex;
613
+            } else {
614
+                $default = $regex;
615
+            }
608 616
 
609 617
             return array($regex, $default, $params);
610 618
         }
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
          */
60 60
         public function init()
61 61
         {
62
-            if (!file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json") || Config::getInstance()->getDebugMode()) {
62
+            if (!file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json") || Config::getInstance()->getDebugMode()) {
63 63
                 $this->hydrateRouting();
64 64
                 $this->simpatize();
65
-            } else {
66
-                list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", Cache::JSON, TRUE);
67
-                $this->domains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", Cache::JSON, TRUE);
65
+            }else {
66
+                list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json", Cache::JSON, TRUE);
67
+                $this->domains = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", Cache::JSON, TRUE);
68 68
             }
69 69
         }
70 70
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                     "success" => FALSE,
85 85
                     "error"   => $e->getMessage(),
86 86
                 )), 'application/json');
87
-            } else {
87
+            }else {
88 88
                 if (NULL === $e) {
89 89
                     $e = new \Exception(_('Página no encontrada'), 404);
90 90
                 }
@@ -124,24 +124,24 @@  discard block
 block discarded – undo
124 124
 
125 125
                 //Search action and execute
126 126
                 return $this->searchAction($route);
127
-            } catch (AccessDeniedException $e) {
127
+            }catch (AccessDeniedException $e) {
128 128
                 Logger::getInstance()->debugLog(_('Solicitamos credenciales de acceso a zona restringida'));
129 129
                 if ('login' === Config::getInstance()->get('admin_login')) {
130 130
                     return $this->redirectLogin($route);
131
-                } else {
131
+                }else {
132 132
                     return $this->sentAuthHeader();
133 133
                 }
134
-            } catch (RouterException $r) {
134
+            }catch (RouterException $r) {
135 135
                 if (FALSE !== preg_match('/\/$/', $route)) {
136 136
                     if (preg_match('/admin/', $route)) {
137 137
                         $default = Config::getInstance()->get('admin_action');
138
-                    } else {
138
+                    }else {
139 139
                         $default = Config::getInstance()->get('home_action');
140 140
                     }
141 141
 
142 142
                     return $this->execute($this->getRoute($default));
143 143
                 }
144
-            } catch (\Exception $e) {
144
+            }catch (\Exception $e) {
145 145
                 Logger::getInstance()->errorLog($e->getMessage());
146 146
                 throw $e;
147 147
             }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $corsEnabled = Config::getInstance()->get('cors.enabled');
158 158
             $request = Request::getInstance();
159 159
             if (NULL !== $corsEnabled && null !== $request->getServer('HTTP_REFERER')) {
160
-                if($corsEnabled == '*' || preg_match($corsEnabled, $request->getServer('HTTP_REFERER'))) {
160
+                if ($corsEnabled == '*' || preg_match($corsEnabled, $request->getServer('HTTP_REFERER'))) {
161 161
                     if (!$this->headersSent) {
162 162
                         header("Access-Control-Allow-Credentials: true");
163 163
                         header("Access-Control-Allow-Origin: *");
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
                         header("Access-Control-Allow-Headers: Access-Control-Allow-Methods, Access-Control-Allow-Headers, Access-Control-Allow-Origin, Origin, X-Requested-With, Content-Type, Accept, Authorization");
166 166
                         $this->headersSent = true;
167 167
                     }
168
-                    if(Request::getInstance()->getMethod() == 'OPTIONS') {
169
-                        header( "HTTP/1.1 200 OK" );
168
+                    if (Request::getInstance()->getMethod() == 'OPTIONS') {
169
+                        header("HTTP/1.1 200 OK");
170 170
                         exit();
171 171
                     }
172 172
                 }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                     $class = $this->getClassToCall($action);
196 196
                     try {
197 197
                         return $this->executeCachedRoute($route, $action, $class, $get);
198
-                    } catch (\Exception $e) {
198
+                    }catch (\Exception $e) {
199 199
                         Logger::getInstance()->debugLog($e->getMessage(), array($e->getFile(), $e->getLine()));
200 200
                         throw new RouterException($e->getMessage(), 404, $e);
201 201
                     }
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
             if (file_exists($modules)) {
284 284
                 $this->routing = $this->inspectDir($modules, "", $this->routing);
285 285
             }
286
-            $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->domains, Cache::JSON, TRUE);
286
+            $this->cache->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", $this->domains, Cache::JSON, TRUE);
287 287
             $home = Config::getInstance()->get('home_action');
288 288
             if (NULL !== $home || $home !== '') {
289 289
                 $home_params = NULL;
290 290
                 foreach ($this->routing as $pattern => $params) {
291 291
                     list($method, $route) = $this->extractHttpRoute($pattern);
292
-                    if (preg_match("/" . preg_quote($route, "/") . "$/i", "/" . $home)) {
292
+                    if (preg_match("/".preg_quote($route, "/")."$/i", "/".$home)) {
293 293
                         $home_params = $params;
294 294
                     }
295 295
                 }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             $files = $this->finder->files()->in($origen)->path('/(controller|api)/i')->name("*.php");
315 315
             foreach ($files as $file) {
316 316
                 $filename = str_replace("/", '\\', str_replace($origen, '', $file->getPathname()));
317
-                $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing);
317
+                $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing);
318 318
             }
319 319
             $this->finder = new Finder();
320 320
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
                                 $httpMethod = $this->extractReflectionHttpMethod($docComments);
356 356
                                 $visible = $this->extractReflectionVisibility($docComments);
357 357
                                 $expiration = $this->extractReflectionCacheability($docComments);
358
-                                $routing[$httpMethod . "#|#" . $regex] = array(
358
+                                $routing[$httpMethod."#|#".$regex] = array(
359 359
                                     "class"   => $namespace,
360 360
                                     "method"  => $method->getName(),
361 361
                                     "params"  => $params,
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
         {
386 386
             //Calculamos los dominios para las plantillas
387 387
             if ($class->hasConstant("DOMAIN")) {
388
-                $domain = "@" . $class->getConstant("DOMAIN") . "/";
389
-                $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
390
-                $path = realpath($path) . DIRECTORY_SEPARATOR;
388
+                $domain = "@".$class->getConstant("DOMAIN")."/";
389
+                $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
390
+                $path = realpath($path).DIRECTORY_SEPARATOR;
391 391
                 $tpl_path = "templates";
392 392
                 $public_path = "public";
393 393
                 $model_path = "models";
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
                     $model_path = ucfirst($model_path);
398 398
                 }
399 399
                 if ($class->hasConstant("TPL")) {
400
-                    $tpl_path .= DIRECTORY_SEPARATOR . $class->getConstant("TPL");
400
+                    $tpl_path .= DIRECTORY_SEPARATOR.$class->getConstant("TPL");
401 401
                 }
402 402
                 $this->domains[$domain] = array(
403
-                    "template" => $path . $tpl_path,
404
-                    "model"    => $path . $model_path,
405
-                    "public"   => $path . $public_path,
403
+                    "template" => $path.$tpl_path,
404
+                    "model"    => $path.$model_path,
405
+                    "public"   => $path.$public_path,
406 406
                 );
407 407
             }
408 408
 
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
          */
416 416
         private function simpatize()
417 417
         {
418
-            $translationFileName = "translations" . DIRECTORY_SEPARATOR . "routes_translations.php";
419
-            $absoluteTranslationFileName = CACHE_DIR . DIRECTORY_SEPARATOR . $translationFileName;
418
+            $translationFileName = "translations".DIRECTORY_SEPARATOR."routes_translations.php";
419
+            $absoluteTranslationFileName = CACHE_DIR.DIRECTORY_SEPARATOR.$translationFileName;
420 420
             $this->generateSlugs($absoluteTranslationFileName);
421 421
             Config::createDir(CONFIG_DIR);
422
-            Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE);
422
+            Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE);
423 423
 
424 424
             return $this;
425 425
         }
@@ -470,16 +470,16 @@  discard block
 block discarded – undo
470 470
         public function getRoute($slug = '', $absolute = FALSE, $params = NULL)
471 471
         {
472 472
             if (strlen($slug) === 0) {
473
-                return ($absolute) ? Request::getInstance()->getRootUrl() . '/' : '/';
473
+                return ($absolute) ? Request::getInstance()->getRootUrl().'/' : '/';
474 474
             }
475 475
             if (NULL === $slug || !array_key_exists($slug, $this->slugs)) {
476 476
                 throw new RouterException(_("No existe la ruta especificada"));
477 477
             }
478
-            $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug];
478
+            $url = ($absolute) ? Request::getInstance()->getRootUrl().$this->slugs[$slug] : $this->slugs[$slug];
479 479
             if (!empty($params)) foreach ($params as $key => $value) {
480
-                $url = str_replace("{" . $key . "}", $value, $url);
480
+                $url = str_replace("{".$key."}", $value, $url);
481 481
             } elseif (!empty($this->routing[$this->slugs[$slug]]["default"])) {
482
-                $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
482
+                $url = ($absolute) ? Request::getInstance()->getRootUrl().$this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
483 483
             }
484 484
 
485 485
             return preg_replace('/(GET|POST|PUT|DELETE|ALL)\#\|\#/', '', $url);
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
                 if (preg_match('/^\/admin(\/|$)/', $routePattern)) {
498 498
                     if (preg_match('/^PSFS/', $params["class"])) {
499 499
                         $profile = "superadmin";
500
-                    } else {
500
+                    }else {
501 501
                         $profile = "admin";
502 502
                     }
503 503
                     if (!empty($params["default"]) && preg_match('/(GET|ALL)/i', $httpMethod)) {
504 504
                         $_profile = ($params["visible"]) ? $profile : 'adminhidden';
505
-                        if(!array_key_exists($_profile, $routes)) {
505
+                        if (!array_key_exists($_profile, $routes)) {
506 506
                             $routes[$_profile] = array();
507 507
                         }
508 508
                         $routes[$_profile][] = $params["slug"];
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
             $expr = preg_quote($expr, '/');
572 572
             $expr = str_replace('###', '(.*)', $expr);
573 573
             $expr2 = preg_replace('/\(\.\*\)$/', '', $expr);
574
-            $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path);
574
+            $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path);
575 575
 
576 576
             return $matched;
577 577
         }
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
             if (count($parameters) > 0) foreach ($parameters as $param) {
610 610
                 if ($param->isOptional() && !is_array($param->getDefaultValue())) {
611 611
                     $params[$param->getName()] = $param->getDefaultValue();
612
-                    $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex);
612
+                    $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue(), $regex);
613 613
                 }
614
-            } else $default = $regex;
614
+            }else $default = $regex;
615 615
 
616 616
             return array($regex, $default, $params);
617 617
         }
@@ -668,16 +668,16 @@  discard block
 block discarded – undo
668 668
          */
669 669
         protected function executeCachedRoute($route, $action, $class, $params = NULL)
670 670
         {
671
-            Logger::getInstance()->debugLog(_('Ruta resuelta para ') . $route);
671
+            Logger::getInstance()->debugLog(_('Ruta resuelta para ').$route);
672 672
             $this->session->setSessionKey("__CACHE__", $action);
673 673
             $cache = Cache::needCache();
674 674
             $execute = TRUE;
675 675
             if (FALSE !== $cache && Config::getInstance()->getDebugMode() === FALSE) {
676 676
                 $cacheDataName = $this->cache->getRequestCacheHash();
677
-                $cachedData = $this->cache->readFromCache("templates" . DIRECTORY_SEPARATOR . $cacheDataName, $cache, function () {
677
+                $cachedData = $this->cache->readFromCache("templates".DIRECTORY_SEPARATOR.$cacheDataName, $cache, function() {
678 678
                 });
679 679
                 if (NULL !== $cachedData) {
680
-                    $headers = $this->cache->readFromCache("templates" . DIRECTORY_SEPARATOR . $cacheDataName . ".headers", $cache, function () {
680
+                    $headers = $this->cache->readFromCache("templates".DIRECTORY_SEPARATOR.$cacheDataName.".headers", $cache, function() {
681 681
                     }, Cache::JSON);
682 682
                     Template::getInstance()->renderCache($cachedData, $headers);
683 683
                     $execute = FALSE;
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
             $translations = array();
727 727
             if (file_exists($absoluteTranslationFileName)) {
728 728
                 include($absoluteTranslationFileName);
729
-            } else {
729
+            }else {
730 730
                 Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE);
731 731
             }
732 732
 
Please login to merge, or discard this patch.
src/base/Security.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -371,7 +371,7 @@
 block discarded – undo
371 371
          * @param array $parts
372 372
          * @param int $partLength
373 373
          *
374
-         * @return array
374
+         * @return string[]
375 375
          */
376 376
         private static function extractTsAndMod(array &$parts, $partLength)
377 377
         {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
         public static function save($user)
79 79
         {
80 80
             $admins = array();
81
-            if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json')) {
82
-                $admins = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json'), TRUE);
81
+            if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json')) {
82
+                $admins = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json'), TRUE);
83 83
             }
84
-            $admins[$user['username']]['hash'] = sha1($user['username'] . $user['password']);
84
+            $admins[$user['username']]['hash'] = sha1($user['username'].$user['password']);
85 85
             $admins[$user['username']]['profile'] = $user['profile'];
86 86
 
87
-            return (FALSE !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', json_encode($admins, JSON_PRETTY_PRINT)));
87
+            return (FALSE !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', json_encode($admins, JSON_PRETTY_PRINT)));
88 88
         }
89 89
 
90 90
         /**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
         public function getAdmins()
105 105
         {
106 106
             $admins = array();
107
-            if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json')) {
108
-                $admins = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json'), TRUE);
107
+            if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json')) {
108
+                $admins = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json'), TRUE);
109 109
             }
110 110
 
111 111
             return $admins;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         {
125 125
             if (!$this->authorized) {
126 126
                 $request = Request::getInstance();
127
-                if (!file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json')) {
127
+                if (!file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json')) {
128 128
                     //Si no hay fichero de usuarios redirigimos directamente al gestor
129 129
                     return Router::getInstance()->getAdmin()->adminers();
130 130
                 }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                 }
138 138
                 if (!empty($user) && !empty($admins[$user])) {
139 139
                     $auth = $admins[$user]['hash'];
140
-                    $this->authorized = ($auth == sha1($user . $pass));
140
+                    $this->authorized = ($auth == sha1($user.$pass));
141 141
                     $this->admin = array(
142 142
                         'alias'   => $user,
143 143
                         'profile' => $admins[$user]['profile'],
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
             $axis = 0;
355 355
             $parts = array();
356 356
             try {
357
-                $partLength = floor(strlen($token) / 10);
358
-                for ($i = 0, $ct = ceil(strlen($token) / $partLength); $i < $ct; $i++) {
357
+                $partLength = floor(strlen($token)/10);
358
+                for ($i = 0, $ct = ceil(strlen($token)/$partLength); $i < $ct; $i++) {
359 359
                     $parts[] = substr($token, $axis, $partLength);
360 360
                     $axis += $partLength;
361 361
                 }
362
-            } catch(\Exception $e) {
362
+            }catch (\Exception $e) {
363 363
                 $partLength = 0;
364 364
             }
365 365
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
             $decoded = NULL;
400 400
             list($partLength, $parts) = self::extractTokenParts($token);
401 401
             list($ts, $mod) = self::extractTsAndMod($parts, $partLength);
402
-            $hashMod = substr(strtoupper(sha1($module)), strlen($ts) / 2, strlen($ts) * 2);
402
+            $hashMod = substr(strtoupper(sha1($module)), strlen($ts)/2, strlen($ts)*2);
403 403
             if (time() - (integer)$ts < 300 && $hashMod === $mod) {
404 404
                 $decoded = implode('', $parts);
405 405
             }
@@ -416,16 +416,16 @@  discard block
 block discarded – undo
416 416
         public static function generateToken($secret, $module = 'PSFS')
417 417
         {
418 418
             $ts = time();
419
-            $hashModule = substr(strtoupper(sha1($module)), strlen($ts) / 2, strlen($ts) * 2);
419
+            $hashModule = substr(strtoupper(sha1($module)), strlen($ts)/2, strlen($ts)*2);
420 420
             $hash = hash('sha256', $secret);
421
-            $insert = floor(strlen($hash) / strlen($ts));
421
+            $insert = floor(strlen($hash)/strlen($ts));
422 422
             $j = 0;
423 423
             $token = '';
424 424
             for ($i = 0, $ct = strlen($ts); $i < $ct; $i++) {
425
-                $token .= substr($ts, $i, 1) . substr($hash, $j, $insert) . substr($hashModule, $i, 2);
425
+                $token .= substr($ts, $i, 1).substr($hash, $j, $insert).substr($hashModule, $i, 2);
426 426
                 $j += $insert;
427 427
             }
428
-            $token .= substr($hash, ($insert * strlen($ts)), strlen($hash) - ($insert * strlen($ts)));
428
+            $token .= substr($hash, ($insert*strlen($ts)), strlen($hash) - ($insert*strlen($ts)));
429 429
             return $token;
430 430
         }
431 431
 
Please login to merge, or discard this patch.
src/base/Service.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,8 +125,8 @@
 block discarded – undo
125 125
         }
126 126
 
127 127
         /**
128
-         * @param $header
129
-         * @param null $content
128
+         * @param string $header
129
+         * @param string $content
130 130
          *
131 131
          * @return $this
132 132
          */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             $this->url = NULL;
178 178
             $this->params = array();
179 179
             $this->headers = array();
180
-            $this->log->debugLog(_("Context service for " . get_called_class() . " cleared!"));
180
+            $this->log->debugLog(_("Context service for ".get_called_class()." cleared!"));
181 181
         }
182 182
 
183 183
         /**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
         protected function setOpts()
210 210
         {
211
-            switch(strtoupper($this->type)) {
211
+            switch (strtoupper($this->type)) {
212 212
                 case 'GET':
213 213
                 default:
214 214
                     curl_setopt($this->con, CURLOPT_CUSTOMREQUEST, "GET");
Please login to merge, or discard this patch.
src/base/Singleton.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -175,10 +175,10 @@
 block discarded – undo
175 175
 
176 176
     /**
177 177
      * Create the depecency injected
178
-     * @param $variable
179
-     * @param $singleton
178
+     * @param string $variable
179
+     * @param boolean $singleton
180 180
      * @param $classNameSpace
181
-     * @param $calledClass
181
+     * @param string $calledClass
182 182
      * @return mixed
183 183
      */
184 184
     private function constructInyectableInstance($variable, $singleton, $classNameSpace, $calledClass)
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
             $setter = "set".ucfirst($variable);
99 99
             if (method_exists($calledClass, $setter)) {
100 100
                 $this->$setter($instance);
101
-            } else {
101
+            }else {
102 102
                 $this->$variable = $instance;
103 103
             }
104
-        } catch (\Exception $e) {
104
+        }catch (\Exception $e) {
105 105
             Logger::getInstance()->errorLog($e->getMessage());
106 106
         }
107 107
         return $this;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         if (true === $singleton && method_exists($varInstanceType, "getInstance")) {
190 190
             $instance = $varInstanceType::getInstance();
191 191
             return $instance;
192
-        } else {
192
+        }else {
193 193
             $instance = new $varInstanceType();
194 194
             return $instance;
195 195
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,11 +125,13 @@
 block discarded – undo
125 125
                 $cacheService->storeData($cacheFilename, $properties, Cache::JSON);
126 126
             }
127 127
             /** @var \ReflectionProperty $property */
128
-            if (!empty($properties) && is_array($properties)) foreach ($properties as $property => $class) {
128
+            if (!empty($properties) && is_array($properties)) {
129
+                foreach ($properties as $property => $class) {
129 130
                 $this->load($property, true, $class);
130 131
             }
132
+            }
131 133
             $this->setLoaded();
132
-        }else {
134
+        } else {
133 135
             $logService->warningLog(get_class($this)." ya cargada");
134 136
         }
135 137
     }
Please login to merge, or discard this patch.
src/base/types/Form.php 3 patches
Doc Comments   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,6 +42,10 @@  discard block
 block discarded – undo
42 42
          * @return Form
43 43
          */
44 44
         public function setEncType($enctype) { $this->enctype = $enctype; return $this; }
45
+
46
+        /**
47
+         * @param string|null $action
48
+         */
45 49
         public function setAction($action) { $this->action = $action; return $this; }
46 50
         public function setMethod($method) { $this->method = $method; return $this; }
47 51
         public function setAttrs(array $attrs) { $this->attrs = $attrs; return $this; }
@@ -466,7 +470,7 @@  discard block
 block discarded – undo
466 470
         }
467 471
 
468 472
         /**
469
-         * @param $token_field
473
+         * @param string $token_field
470 474
          * @return bool
471 475
          */
472 476
         protected function existsFormToken($token_field) {
@@ -494,7 +498,7 @@  discard block
 block discarded – undo
494 498
         /**
495 499
          * Método que extrae el valor de un campo del formulario del modelo
496 500
          * @param $field
497
-         * @param $value
501
+         * @param ObjectCollection $value
498 502
          * @param $type
499 503
          * @return mixed
500 504
          */
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     use PSFS\base\Singleton;
13 13
     use PSFS\base\types\interfaces\FormType;
14 14
 
15
-    abstract class Form extends Singleton implements FormType{
15
+    abstract class Form extends Singleton implements FormType {
16 16
 
17 17
         /**
18 18
          * Variables de formulario
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
         public function __construct($model = null)
33 33
         {
34
-            if(null !== $model) {
34
+            if (null !== $model) {
35 35
                 $this->model = $model;
36 36
             }
37 37
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
          */
123 123
         public function getFieldValue($name) {
124 124
             $value = null;
125
-            if (null !== $this->getField($name)){
125
+            if (null !== $this->getField($name)) {
126 126
                 $field = $this->getField($name);
127 127
                 $value = (array_key_exists('value', $field) && null !== $field['value']) ? $field['value'] : null;
128 128
             }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                 $model->save();
324 324
                 $save = true;
325 325
                 Logger::getInstance()->infoLog(get_class($this->model)." guardado con id ".$this->model->getPrimaryKey());
326
-            } catch (\Exception $e) {
326
+            }catch (\Exception $e) {
327 327
                 Logger::getInstance()->errorLog($e->getMessage());
328 328
                 throw new FormException($e->getMessage(), $e->getCode(), $e);
329 329
             }
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
             if (array_key_exists($key, $data[$form_name])) {
370 370
                 if (preg_match("/id/i", $key) && ($data[$form_name][$key] === 0 || $data[$form_name][$key] === "%" || $data[$form_name][$key] === "")) {
371 371
                     $field["value"] = null;
372
-                } else {
372
+                }else {
373 373
                     $field["value"] = $data[$form_name][$key];
374 374
                 }
375
-            } else {
375
+            }else {
376 376
                 unset($field["value"]);
377 377
             }
378 378
             return array($data, $field);
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
                 if (array_key_exists('class_id', $field) && method_exists($class, "get".$field["class_id"])) {
417 417
                     $method = "get".$field["class_id"];
418 418
                     $data[] = $class->$method();
419
-                } else {
419
+                }else {
420 420
                     $data[] = $class->getPrimaryKey();
421 421
                 }
422
-            } else {
422
+            }else {
423 423
                 $data[] = $val;
424 424
             }
425 425
 
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
                             $field["value"] = $value;
450 450
                         } elseif ($value instanceof \DateTime) {
451 451
                             $field["value"] = $value->format("Y-m-d H:i:s");
452
-                        } else {
452
+                        }else {
453 453
                             $field["value"] = $value->getPrimaryKey();
454 454
                         }
455 455
                     }
456
-                } else {
456
+                }else {
457 457
                     $field["value"] = $value;
458 458
                 }
459 459
             }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,9 @@  discard block
 block discarded – undo
157 157
             if ($valid) {
158 158
                 if (count($this->fields) > 0) {
159 159
                     foreach ($this->fields as $key => &$field) {
160
-                        if ($key === self::SEPARATOR) continue;
160
+                        if ($key === self::SEPARATOR) {
161
+                            continue;
162
+                        }
161 163
                         list($field, $valid) = $this->checkFieldValidation($field, $key);
162 164
                     }
163 165
                 }
@@ -444,7 +446,7 @@  discard block
 block discarded – undo
444 446
                     //Si es una relación múltiple
445 447
                     if ($value instanceof ObjectCollection) {
446 448
                         $field = $this->computeModelFieldValue($field, $value, $type);
447
-                    }else { //O una relación unitaria
449
+                    } else { //O una relación unitaria
448 450
                         if (method_exists($value, "__toString")) {
449 451
                             $field["value"] = $value;
450 452
                         } elseif ($value instanceof \DateTime) {
Please login to merge, or discard this patch.
src/controller/Admin.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      * Servicio que devuelve los parámetros disponibles
303 303
      * @route /admin/config/params
304 304
      * @visible false
305
-     * @return mixed
305
+     * @return string|null
306 306
      */
307 307
     public function getConfigParams() {
308 308
         $response = array_merge(Config::$required, Config::$optional);
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
      * Servicio que devuelve los parámetros disponibles
331 331
      * @route /admin/routes/show
332 332
      * @visible false
333
-     * @return mixed
333
+     * @return string|null
334 334
      */
335 335
     public function getRouting()
336 336
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -175,7 +175,9 @@
 block discarded – undo
175 175
      */
176 176
     public function getTranslations($locale = '') {
177 177
         //Idioma por defecto
178
-        if(empty($locale)) $locale = $this->config->get("default_language");
178
+        if(empty($locale)) {
179
+            $locale = $this->config->get("default_language");
180
+        }
179 181
 
180 182
         //Generamos las traducciones de las plantillas
181 183
         $translations = $this->tpl->regenerateTemplates();
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @package PSFS\controller
21 21
  * @domain ROOT
22 22
  */
23
-class Admin extends AuthAdminController{
23
+class Admin extends AuthAdminController {
24 24
 
25 25
     const DOMAIN = 'ROOT';
26 26
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 Logger::getInstance()->infoLog("Configuración guardada correctamente");
85 85
                 $this->security->setFlash("callback_message", _("Usuario agregado correctamente"));
86 86
                 $this->security->setFlash("callback_route", $this->getRoute("admin"), true);
87
-            } else {
87
+            }else {
88 88
                 throw new \HttpException('Error al guardar los administradores, prueba a cambiar los permisos', 403);
89 89
             }
90 90
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                 $cookies = array(
151 151
                     array(
152 152
                         "name" => Security::getInstance()->getHash(),
153
-                        "value" => base64_encode($form->getFieldValue("user") . ":" . $form->getFieldValue("pass")),
153
+                        "value" => base64_encode($form->getFieldValue("user").":".$form->getFieldValue("pass")),
154 154
                         "expire" => time() + 3600,
155 155
                         "http" => true,
156 156
                     )
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                     'status_message' => _("Acceso permitido... redirigiendo!!"),
162 162
                     'delay' => 1,
163 163
                 );
164
-            } else {
164
+            }else {
165 165
                 $form->setError("user", _("El usuario no tiene acceso a la web"));
166 166
             }
167 167
         }
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function getTranslations($locale = '') {
179 179
         //Idioma por defecto
180
-        if(empty($locale)) $locale = $this->config->get("default_language");
180
+        if (empty($locale)) $locale = $this->config->get("default_language");
181 181
 
182 182
         //Generamos las traducciones de las plantillas
183 183
         $translations = $this->tpl->regenerateTemplates();
184 184
 
185
-        $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
186
-        $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR;
185
+        $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
186
+        $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR;
187 187
 
188 188
         //Localizamos xgettext
189 189
         $translations = array_merge($translations, GeneratorService::findTranslations(SOURCE_DIR, $locale));
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
         $form = new ConfigForm();
231 231
         $form->build();
232 232
         $form->hydrate();
233
-        if($form->isValid()) {
233
+        if ($form->isValid()) {
234 234
             $debug = Config::getInstance()->getDebugMode();
235 235
             $newDebug = $form->getFieldValue("debug");
236
-            if(Config::save($form->getData(), $form->getExtraData())) {
236
+            if (Config::save($form->getData(), $form->getExtraData())) {
237 237
                 Logger::getInstance()->infoLog(_('Configuración guardada correctamente'));
238 238
                 //Verificamos si tenemos que limpiar la cache del DocumentRoot
239
-                if(boolval($debug) !== boolval($newDebug)) {
239
+                if (boolval($debug) !== boolval($newDebug)) {
240 240
                     Config::clearDocumentRoot();
241 241
                 }
242 242
                 $this->security->setFlash("callback_message", _("Configuración actualizada correctamente"));
243 243
                 $this->security->setFlash("callback_route", $this->getRoute("admin-config", true));
244
-            } else {
244
+            }else {
245 245
                 throw new \HttpException(_('Error al guardar la configuración, prueba a cambiar los permisos'), 403);
246 246
             }
247 247
         }
@@ -300,10 +300,10 @@  discard block
 block discarded – undo
300 300
             $type = $form->getFieldValue("controllerType");
301 301
             try {
302 302
                 $this->gen->createStructureModule($module, $force, $type);
303
-                $this->security->setFlash("callback_message", str_replace("%s",$module, _("Módulo %s generado correctamente")));
303
+                $this->security->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente")));
304 304
                 $this->security->setFlash("callback_route", $this->getRoute("admin-module", true));
305
-            } catch(\Exception $e) {
306
-                Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
305
+            }catch (\Exception $e) {
306
+                Logger::getInstance()->infoLog($e->getMessage()." [".$e->getFile().":".$e->getLine()."]");
307 307
                 throw new ConfigException('Error al generar el módulo, prueba a cambiar los permisos', 403);
308 308
             }
309 309
         }
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
     public function getConfigParams() {
326 326
         $response = array_merge(Config::$required, Config::$optional);
327 327
         $domains = Router::getInstance()->getDomains();
328
-        foreach($domains as $domain => $routes) {
328
+        foreach ($domains as $domain => $routes) {
329 329
             $pDomain = str_replace('@', '', $domain);
330 330
             $pDomain = str_replace('/', '', $pDomain);
331
-            $response[] = strtolower($pDomain) . '.api.secret';
331
+            $response[] = strtolower($pDomain).'.api.secret';
332 332
         }
333 333
         return $this->json($response);
334 334
     }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 
371 371
         $selected = '';
372 372
         $monthOpen = null;
373
-        if($this->getRequest()->getMethod() == 'POST')
373
+        if ($this->getRequest()->getMethod() == 'POST')
374 374
         {
375 375
             $selected = $this->getRequest()->get("log");
376 376
             list($log, $monthOpen) = $this->srv->formatLogFile($selected);
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
             $router->simpatize();
399 399
             $this->security->setFlash("callback_message", _("Rutas generadas correctamente"));
400 400
             $this->security->setFlash("callback_route", $this->getRoute("admin", true));
401
-        } catch(\Exception $e) {
401
+        }catch (\Exception $e) {
402 402
             Logger::getInstance()->errorLog($e->getMessage());
403 403
             $this->security->setFlash("callback_message", _("Algo no ha salido bien, revisa los logs"));
404 404
             $this->security->setFlash("callback_route", $this->getRoute("admin", true));
Please login to merge, or discard this patch.