Test Failed
Push — master ( a40e1b...f9a6ef )
by Fran
03:44
created
src/base/Router.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -393,8 +393,10 @@
 block discarded – undo
393 393
             throw new RouterException(_("No existe la ruta especificada"));
394 394
         }
395 395
         $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug];
396
-        if (!empty($params)) foreach ($params as $key => $value) {
396
+        if (!empty($params)) {
397
+            foreach ($params as $key => $value) {
397 398
             $url = str_replace("{" . $key . "}", $value, $url);
399
+        }
398 400
         } elseif (!empty($this->routing[$this->slugs[$slug]]["default"])) {
399 401
             $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
400 402
         }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function init()
59 59
     {
60
-        if (!file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json") || Config::getInstance()->getDebugMode()) {
60
+        if (!file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json") || Config::getInstance()->getDebugMode()) {
61 61
             $this->hydrateRouting();
62 62
             $this->simpatize();
63
-        } else {
64
-            list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", Cache::JSON, TRUE);
65
-            $this->domains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", Cache::JSON, TRUE);
63
+        }else {
64
+            list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json", Cache::JSON, TRUE);
65
+            $this->domains = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", Cache::JSON, TRUE);
66 66
         }
67 67
     }
68 68
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 "success" => FALSE,
83 83
                 "error" => $e->getMessage(),
84 84
             )), 'application/json');
85
-        } else {
85
+        }else {
86 86
             if (NULL === $e) {
87 87
                 Logger::log('Not found page throwed without previous exception', LOG_WARNING);
88 88
                 $e = new \Exception(_('Page not found'), 404);
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function getAllRoutes() {
113 113
         $routes = [];
114
-        foreach($this->routing as $path => $route) {
115
-            if(array_key_exists('slug', $route)) {
114
+        foreach ($this->routing as $path => $route) {
115
+            if (array_key_exists('slug', $route)) {
116 116
                 $routes[$route['slug']] = $path;
117 117
             }
118 118
         }
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
             SecurityHelper::checkRestrictedAccess($route);
138 138
             //Search action and execute
139 139
             $this->searchAction($route);
140
-        } catch (AccessDeniedException $e) {
140
+        }catch (AccessDeniedException $e) {
141 141
             Logger::log(_('Solicitamos credenciales de acceso a zona restringida'));
142 142
             return Admin::staticAdminLogon($route);
143
-        } catch (RouterException $r) {
144
-            if(null === RouterHelper::checkDefaultRoute($route)) {
143
+        }catch (RouterException $r) {
144
+            if (null === RouterHelper::checkDefaultRoute($route)) {
145 145
                 Logger::log($r->getMessage(), LOG_WARNING);
146 146
                 throw $r;
147 147
             }
148
-        } catch (\Exception $e) {
148
+        }catch (\Exception $e) {
149 149
             Logger::log($e->getMessage(), LOG_ERR);
150 150
             throw $e;
151 151
         }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     protected function searchAction($route)
164 164
     {
165
-        Logger::log('Searching action to execute: ' . $route, LOG_INFO);
165
+        Logger::log('Searching action to execute: '.$route, LOG_INFO);
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;
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                 $class = RouterHelper::getClassToCall($action);
177 177
                 try {
178 178
                     $this->executeCachedRoute($route, $action, $class, $get);
179
-                } catch (\Exception $e) {
179
+                }catch (\Exception $e) {
180 180
                     Logger::log($e->getMessage(), LOG_ERR);
181 181
                     throw new RouterException($e->getMessage(), 404, $e);
182 182
                 }
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
         $this->routing = $this->inspectDir($base, "PSFS", array());
205 205
         if (file_exists($modules)) {
206 206
             $module = "";
207
-            if(file_exists($modules . DIRECTORY_SEPARATOR . 'module.json')) {
208
-                $mod_cfg = json_decode(file_get_contents($modules . DIRECTORY_SEPARATOR . 'module.json'), true);
207
+            if (file_exists($modules.DIRECTORY_SEPARATOR.'module.json')) {
208
+                $mod_cfg = json_decode(file_get_contents($modules.DIRECTORY_SEPARATOR.'module.json'), true);
209 209
                 $module = $mod_cfg['module'];
210 210
             }
211 211
             $this->routing = $this->inspectDir($modules, $module, $this->routing);
212 212
         }
213
-        $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->domains, Cache::JSON, TRUE);
213
+        $this->cache->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", $this->domains, Cache::JSON, TRUE);
214 214
     }
215 215
 
216 216
     /**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             $home_params = NULL;
226 226
             foreach ($this->routing as $pattern => $params) {
227 227
                 list($method, $route) = RouterHelper::extractHttpRoute($pattern);
228
-                if (preg_match("/" . preg_quote($route, "/") . "$/i", "/" . $home)) {
228
+                if (preg_match("/".preg_quote($route, "/")."$/i", "/".$home)) {
229 229
                     $home_params = $params;
230 230
                 }
231 231
             }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         $files = $this->finder->files()->in($origen)->path('/(controller|api)/i')->name("*.php");
251 251
         foreach ($files as $file) {
252 252
             $filename = str_replace("/", '\\', str_replace($origen, '', $file->getPathname()));
253
-            $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing);
253
+            $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing);
254 254
         }
255 255
         $this->finder = new Finder();
256 256
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                 }
290 290
                 foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
291 291
                     list($route, $info) = RouterHelper::extractRouteInfo($method, $api);
292
-                    if(null !== $route && null !== $info) {
292
+                    if (null !== $route && null !== $info) {
293 293
                         $info['class'] = $namespace;
294 294
                         $routing[$route] = $info;
295 295
                     }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     {
313 313
         //Calculamos los dominios para las plantillas
314 314
         if ($class->hasConstant("DOMAIN")) {
315
-            $domain = "@" . $class->getConstant("DOMAIN") . "/";
315
+            $domain = "@".$class->getConstant("DOMAIN")."/";
316 316
             $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain);
317 317
         }
318 318
 
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
      */
326 326
     public function simpatize()
327 327
     {
328
-        $translationFileName = "translations" . DIRECTORY_SEPARATOR . "routes_translations.php";
329
-        $absoluteTranslationFileName = CACHE_DIR . DIRECTORY_SEPARATOR . $translationFileName;
328
+        $translationFileName = "translations".DIRECTORY_SEPARATOR."routes_translations.php";
329
+        $absoluteTranslationFileName = CACHE_DIR.DIRECTORY_SEPARATOR.$translationFileName;
330 330
         $this->generateSlugs($absoluteTranslationFileName);
331 331
         Config::createDir(CONFIG_DIR);
332
-        Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE);
332
+        Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE);
333 333
 
334 334
         return $this;
335 335
     }
@@ -380,16 +380,16 @@  discard block
 block discarded – undo
380 380
     public function getRoute($slug = '', $absolute = FALSE, $params = [])
381 381
     {
382 382
         if (strlen($slug) === 0) {
383
-            return ($absolute) ? Request::getInstance()->getRootUrl() . '/' : '/';
383
+            return ($absolute) ? Request::getInstance()->getRootUrl().'/' : '/';
384 384
         }
385 385
         if (NULL === $slug || !array_key_exists($slug, $this->slugs)) {
386 386
             throw new RouterException(_("No existe la ruta especificada"));
387 387
         }
388
-        $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug];
388
+        $url = ($absolute) ? Request::getInstance()->getRootUrl().$this->slugs[$slug] : $this->slugs[$slug];
389 389
         if (!empty($params)) foreach ($params as $key => $value) {
390
-            $url = str_replace("{" . $key . "}", $value, $url);
390
+            $url = str_replace("{".$key."}", $value, $url);
391 391
         } elseif (!empty($this->routing[$this->slugs[$slug]]["default"])) {
392
-            $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
392
+            $url = ($absolute) ? Request::getInstance()->getRootUrl().$this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
393 393
         }
394 394
 
395 395
         return preg_replace('/(GET|POST|PUT|DELETE|ALL)\#\|\#/', '', $url);
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             if (preg_match('/^\/admin(\/|$)/', $routePattern)) {
408 408
                 if (preg_match('/^\\\?PSFS/', $params["class"])) {
409 409
                     $profile = "superadmin";
410
-                } else {
410
+                }else {
411 411
                     $profile = "admin";
412 412
                 }
413 413
                 if (!empty($params["default"]) && preg_match('/(GET|ALL)/i', $httpMethod)) {
@@ -459,17 +459,17 @@  discard block
 block discarded – undo
459 459
      */
460 460
     protected function executeCachedRoute($route, $action, $class, $params = NULL)
461 461
     {
462
-        Logger::log('Executing route ' . $route, LOG_INFO);
462
+        Logger::log('Executing route '.$route, LOG_INFO);
463 463
         Security::getInstance()->setSessionKey("__CACHE__", $action);
464 464
         $cache = Cache::needCache();
465 465
         $execute = TRUE;
466 466
         if (FALSE !== $cache && Config::getInstance()->getDebugMode() === FALSE) {
467 467
             $cacheDataName = $this->cache->getRequestCacheHash();
468
-            $cachedData = $this->cache->readFromCache("templates" . DIRECTORY_SEPARATOR . $cacheDataName,
469
-                $cache, function () {});
468
+            $cachedData = $this->cache->readFromCache("templates".DIRECTORY_SEPARATOR.$cacheDataName,
469
+                $cache, function() {});
470 470
             if (NULL !== $cachedData) {
471
-                $headers = $this->cache->readFromCache("templates" . DIRECTORY_SEPARATOR . $cacheDataName . ".headers",
472
-                    $cache, function () {}, Cache::JSON);
471
+                $headers = $this->cache->readFromCache("templates".DIRECTORY_SEPARATOR.$cacheDataName.".headers",
472
+                    $cache, function() {}, Cache::JSON);
473 473
                 Template::getInstance()->renderCache($cachedData, $headers);
474 474
                 $execute = FALSE;
475 475
             }
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         $translations = array();
516 516
         if (file_exists($absoluteTranslationFileName)) {
517 517
             include($absoluteTranslationFileName);
518
-        } else {
518
+        }else {
519 519
             Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE);
520 520
         }
521 521
 
Please login to merge, or discard this patch.
src/controller/UserController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                 Logger::log('Configuration saved successful');
54 54
                 Security::getInstance()->setFlash("callback_message", _("Usuario agregado correctamente"));
55 55
                 Security::getInstance()->setFlash("callback_route", $this->getRoute("admin"), true);
56
-            } else {
56
+            }else {
57 57
                 throw new ConfigException(_('Error al guardar los administradores, prueba a cambiar los permisos'));
58 58
             }
59 59
         }
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function adminLogin($route = null)
76 76
     {
77
-        if($this->isAdmin()) {
77
+        if ($this->isAdmin()) {
78 78
             return $this->redirect('admin');
79
-        } else {
79
+        }else {
80 80
             return Admin::staticAdminLogon($route);
81 81
         }
82 82
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                 $cookies = array(
109 109
                     array(
110 110
                         "name" => Security::getInstance()->getHash(),
111
-                        "value" => base64_encode($form->getFieldValue("user") . ":" . $form->getFieldValue("pass")),
111
+                        "value" => base64_encode($form->getFieldValue("user").":".$form->getFieldValue("pass")),
112 112
                         "expire" => time() + 3600,
113 113
                         "http" => true,
114 114
                     )
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                     'status_message' => _("Acceso permitido... redirigiendo!!"),
120 120
                     'delay' => 1,
121 121
                 );
122
-            } else {
122
+            }else {
123 123
                 $form->setError("user", _("El usuario no tiene acceso a la web"));
124 124
             }
125 125
         }
Please login to merge, or discard this patch.
src/controller/base/Admin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @package PSFS\controller
15 15
  * @domain ROOT
16 16
  */
17
-class Admin extends AuthAdminController{
17
+class Admin extends AuthAdminController {
18 18
 
19 19
     const DOMAIN = 'ROOT';
20 20
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
      * @throws \PSFS\base\exception\FormException
45 45
      */
46 46
     public static function staticAdminLogon($route = null) {
47
-        if('login' !== Config::getInstance()->get('admin_login')) {
47
+        if ('login' !== Config::getInstance()->get('admin_login')) {
48 48
             return AdminServices::getInstance()->setAdminHeaders();
49
-        } else {
49
+        }else {
50 50
             $form = new LoginForm();
51 51
             $form->setData(array("route" => $route));
52 52
             $form->build();
Please login to merge, or discard this patch.
src/bootstrap.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@  discard block
 block discarded – undo
4 4
 
5 5
 if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__);
6 6
 if (preg_match('/vendor/', SOURCE_DIR)) {
7
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
8
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
9
-} else {
10
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
11
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
7
+    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');
8
+    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src');
9
+}else {
10
+    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..');
11
+    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules');
12 12
 }
13
-if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
14
-if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
15
-if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
16
-if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
13
+if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
14
+if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache');
15
+if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config');
16
+if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html');
17 17
 
18 18
 //Cargamos en memoria la función de desarrollo PRE
19 19
 if (!function_exists('pre')) {
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $html = '<pre style="padding:10px;margin:0;display:block;background: #EEE; box-shadow: inset 0 0 3px 3px #DDD; color: #666; text-shadow: 1px 1px 1px #CCC;border-radius: 5px;">';
23 23
         $html .= (is_null($var)) ? '<b>NULL</b>' : print_r($var, TRUE);
24 24
         $html .= '</pre>';
25
-        if(class_exists('\\PSFS\\Dispatcher')) {
25
+        if (class_exists('\\PSFS\\Dispatcher')) {
26 26
             $html .= '<pre>['.round(\PSFS\Dispatcher::getInstance()->getMem('MBytes'), 3).'Mb - '.round(\PSFS\Dispatcher::getInstance()->getTs(), 3).'s]</pre>';
27 27
         }
28 28
         ob_start();
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         ob_flush();
31 31
         ob_end_clean();
32 32
         if ($die) {
33
-            if(class_exists('\\PSFS\\base\\Logger')) {
33
+            if (class_exists('\\PSFS\\base\\Logger')) {
34 34
                 \PSFS\base\Logger::log('Execution finished via pre', LOG_WARNING);
35 35
             }
36 36
             die;
Please login to merge, or discard this patch.
Braces   +31 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,19 +1,39 @@
 block discarded – undo
1 1
 <?php
2
-if (defined('PSFS_BOOTSTRAP_LOADED')) return;
2
+if (defined('PSFS_BOOTSTRAP_LOADED')) {
3
+    return;
4
+}
3 5
 use Symfony\Component\Finder\Finder;
4 6
 
5
-if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__);
7
+if (!defined('SOURCE_DIR')) {
8
+    define('SOURCE_DIR', __DIR__);
9
+}
6 10
 if (preg_match('/vendor/', SOURCE_DIR)) {
7
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
8
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
9
-} else {
10
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
11
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
11
+    if (!defined('BASE_DIR')) {
12
+        define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
13
+    }
14
+    if (!defined('CORE_DIR')) {
15
+        define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
16
+    }
17
+    } else {
18
+    if (!defined('BASE_DIR')) {
19
+        define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
20
+    }
21
+    if (!defined('CORE_DIR')) {
22
+        define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
23
+    }
24
+    }
25
+if (!defined('LOG_DIR')) {
26
+    define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
27
+}
28
+if (!defined('CACHE_DIR')) {
29
+    define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
30
+}
31
+if (!defined('CONFIG_DIR')) {
32
+    define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
33
+}
34
+if (!defined('WEB_DIR')) {
35
+    define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
12 36
 }
13
-if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
14
-if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
15
-if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
16
-if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
17 37
 
18 38
 //Cargamos en memoria la función de desarrollo PRE
19 39
 if (!function_exists('pre')) {
Please login to merge, or discard this patch.
src/base/Template.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $this->setStatusHeader();
128 128
         $this->setAuthHeaders();
129 129
         $this->setCookieHeaders($cookies);
130
-        header('Content-type: ' . $contentType);
130
+        header('Content-type: '.$contentType);
131 131
 
132 132
     }
133 133
 
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
         Logger::log('Start output response');
144 144
         ob_start();
145 145
         $this->setReponseHeaders($contentType, $cookies);
146
-        header('Content-length: ' . strlen($output));
146
+        header('Content-length: '.strlen($output));
147 147
 
148 148
         $cache = Cache::needCache();
149 149
         if (false !== $cache && $this->status_code === Template::STATUS_OK && $this->debug === false) {
150 150
             Logger::log('Saving output response into cache');
151 151
             $cacheName = $this->cache->getRequestCacheHash();
152
-            $this->cache->storeData("json" . DIRECTORY_SEPARATOR . $cacheName, $output);
153
-            $this->cache->storeData("json" . DIRECTORY_SEPARATOR . $cacheName . ".headers", headers_list(), Cache::JSON);
152
+            $this->cache->storeData("json".DIRECTORY_SEPARATOR.$cacheName, $output);
153
+            $this->cache->storeData("json".DIRECTORY_SEPARATOR.$cacheName.".headers", headers_list(), Cache::JSON);
154 154
         }
155 155
         echo $output;
156 156
 
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
     {
168 168
         Logger::log('Close template render');
169 169
         Security::getInstance()->setSessionKey("lastRequest", array(
170
-            "url" => Request::getInstance()->getRootUrl() . Request::requestUri(),
170
+            "url" => Request::getInstance()->getRootUrl().Request::requestUri(),
171 171
             "ts" => microtime(true),
172 172
         ));
173 173
         Security::getInstance()->updateSession();
174
-        Logger::log('End request: ' . Request::requestUri(), LOG_INFO);
174
+        Logger::log('End request: '.Request::requestUri(), LOG_INFO);
175 175
         exit;
176 176
     }
177 177
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $dump = '';
221 221
         try {
222 222
             $dump = $this->tpl->render($tpl, $vars);
223
-        } catch (\Exception $e) {
223
+        }catch (\Exception $e) {
224 224
             Logger::log($e->getMessage(), LOG_ERR);
225 225
         }
226 226
         return $dump;
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     public function regenerateTemplates()
335 335
     {
336 336
         $this->generateTemplatesCache();
337
-        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", Cache::JSON, true);
337
+        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", Cache::JSON, true);
338 338
         $translations = [];
339 339
         if (is_array($domains)) {
340 340
             $translations = $this->parsePathTranslations($domains);
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
             // force compilation
357 357
             if ($file->isFile()) {
358 358
                 try {
359
-                    $this->tpl->loadTemplate(str_replace($tplDir . '/', '', $file));
360
-                } catch (\Exception $e) {
359
+                    $this->tpl->loadTemplate(str_replace($tplDir.'/', '', $file));
360
+                }catch (\Exception $e) {
361 361
                     Logger::log($e->getMessage(), LOG_ERR);
362 362
                     throw $e;
363 363
                 }
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
             unset($_SERVER["PHP_AUTH_USER"]);
429 429
             unset($_SERVER["PHP_AUTH_PW"]);
430 430
             header_remove("Authorization");
431
-        } else {
431
+        }else {
432 432
             header('Authorization:');
433 433
         }
434 434
     }
@@ -455,9 +455,9 @@  discard block
 block discarded – undo
455 455
             Logger::log('Adding debug headers to render response');
456 456
             $vars["__DEBUG__"]["includes"] = get_included_files();
457 457
             $vars["__DEBUG__"]["trace"] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
458
-            header('X-PSFS-DEBUG-TS: ' . Dispatcher::getInstance()->getTs() . ' s');
459
-            header('X-PSFS-DEBUG-MEM: ' . Dispatcher::getInstance()->getMem('MBytes') . ' MBytes');
460
-            header('X-PSFS-DEBUG-FILES: ' . count(get_included_files()) . ' files opened');
458
+            header('X-PSFS-DEBUG-TS: '.Dispatcher::getInstance()->getTs().' s');
459
+            header('X-PSFS-DEBUG-MEM: '.Dispatcher::getInstance()->getMem('MBytes').' MBytes');
460
+            header('X-PSFS-DEBUG-FILES: '.count(get_included_files()).' files opened');
461 461
         }
462 462
 
463 463
         return $vars;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         $this->cache = Cache::getInstance();
500 500
         $loader = new \Twig_Loader_Filesystem(Config::getInstance()->getTemplatePath());
501 501
         $this->tpl = new \Twig_Environment($loader, array(
502
-            'cache' => Config::getInstance()->getCachePath() . DIRECTORY_SEPARATOR . 'twig',
502
+            'cache' => Config::getInstance()->getCachePath().DIRECTORY_SEPARATOR.'twig',
503 503
             'debug' => (bool)$this->debug,
504 504
             'auto_reload' => TRUE,
505 505
         ));
Please login to merge, or discard this patch.
src/base/types/Controller.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
     public function render($template, array $vars = array(), $cookies = array(), $domain = null)
36 36
     {
37 37
         $vars['__menu__'] = $this->getMenu();
38
-        $domain = (null ===$domain) ? $this->getDomain() : $domain;
39
-        $this->tpl->render($domain . $template, $vars, $cookies);
38
+        $domain = (null === $domain) ? $this->getDomain() : $domain;
39
+        $this->tpl->render($domain.$template, $vars, $cookies);
40 40
     }
41 41
 
42 42
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $vars['__menu__'] = $this->getMenu();
69 69
         $domain = $domain ?: $this->getDomain();
70
-        return $this->tpl->dump($domain . $template, $vars);
70
+        return $this->tpl->dump($domain.$template, $vars);
71 71
     }
72 72
 
73 73
     /**
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
         /////////////////////////////////////////////////////////////
97 97
         // Date in the past sets the value to already have been expired.
98 98
         header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
99
-        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
99
+        header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
100 100
         header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
101 101
         header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
102 102
         header("Pragma: no-cache");
103 103
         header("Expires: 0");
104 104
         header('Content-Transfer-Encoding: none');
105
-        header("Content-type: " . $content);
106
-        header("Content-length: " . strlen($data));
107
-        header('Content-Disposition: attachment; filename="' . $filename . '"');
105
+        header("Content-type: ".$content);
106
+        header("Content-length: ".strlen($data));
107
+        header('Content-Disposition: attachment; filename="'.$filename.'"');
108 108
         echo $data;
109 109
         ob_flush();
110 110
         ob_end_clean();
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
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
             try {
31 31
                 $reflectionClass = new \ReflectionClass($this);
32 32
                 $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC);
33
-                if(count($properties) > 0) {
33
+                if (count($properties) > 0) {
34 34
                     /** @var \ReflectionProperty $property */
35
-                    foreach($properties as $property) {
35
+                    foreach ($properties as $property) {
36 36
                         $dto[$property->getName()] = $property->getValue($this);
37 37
                     }
38 38
                 }
39
-            } catch(\Exception $e) {
40
-                Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
39
+            }catch (\Exception $e) {
40
+                Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
41 41
             }
42 42
             return $dto;
43 43
         }
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
          */
58 58
         public function fromArray(array $object = array())
59 59
         {
60
-            if(count($object) > 0) {
61
-                foreach($object as $key => $value) {
62
-                    if(property_exists($this, $key)) {
60
+            if (count($object) > 0) {
61
+                foreach ($object as $key => $value) {
62
+                    if (property_exists($this, $key)) {
63 63
                         $this->$key = $value;
64 64
                     }
65 65
                 }
Please login to merge, or discard this patch.
src/base/types/SingletonTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@
 block discarded – undo
33 33
          */
34 34
         private static function __init($instance) {
35 35
             $loaded = false;
36
-            if(method_exists($instance, 'isLoaded')) {
36
+            if (method_exists($instance, 'isLoaded')) {
37 37
                 $loaded = $instance->isLoaded();
38 38
             }
39
-            if(false === $loaded && method_exists($instance, "init")) {
39
+            if (false === $loaded && method_exists($instance, "init")) {
40 40
                 $instance->init();
41 41
             }
42 42
         }
Please login to merge, or discard this patch.
src/base/types/helpers/InjectorHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public static function constructInyectableInstance($variable, $singleton, $classNameSpace, $calledClass)
56 56
     {
57
-        Logger::log('Create inyectable instance for ' . $classNameSpace);
57
+        Logger::log('Create inyectable instance for '.$classNameSpace);
58 58
         $reflector = new \ReflectionClass($calledClass);
59 59
         $property = $reflector->getProperty($variable);
60 60
         $varInstanceType = (null === $classNameSpace) ? InjectorHelper::extractVarType($property->getDocComment()) : $classNameSpace;
61 61
         if (true === $singleton && method_exists($varInstanceType, "getInstance")) {
62 62
             $instance = $varInstanceType::getInstance();
63
-        } else {
63
+        }else {
64 64
             $instance = new $varInstanceType();
65 65
         }
66 66
         return $instance;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public static function getClassProperties($class)
75 75
     {
76 76
         $properties = [];
77
-        Logger::log('Extracting annotations properties from class ' . $class);
77
+        Logger::log('Extracting annotations properties from class '.$class);
78 78
         $selfReflector = new \ReflectionClass($class);
79 79
         if (false !== $selfReflector->getParentClass()) {
80 80
             $properties = self::getClassProperties($selfReflector->getParentClass()->getName());
Please login to merge, or discard this patch.