Passed
Push — master ( 1c0893...f7ffcc )
by Fran
03:22
created
src/base/types/helpers/RouterHelper.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
     /**
618 618
      * Método que extrae los parámetros de una función
619 619
      *
620
-     * @param array $sr
620
+     * @param string[] $sr
621 621
      * @param \ReflectionMethod $method
622 622
      *
623 623
      * @return array
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
      *
671 671
      * @param string $docComments
672 672
      *
673
-     * @return bool
673
+     * @return string
674 674
      */
675 675
     private function extractReflectionCacheability($docComments)
676 676
     {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public static function getClassToCall($action)
20 20
     {
21 21
         Logger::log('Getting class to call for executing the request action', LOG_DEBUG, $action);
22
-        $actionClass = class_exists($action["class"]) ? $action["class"] : "\\" . $action["class"];
22
+        $actionClass = class_exists($action["class"]) ? $action["class"] : "\\".$action["class"];
23 23
         $class = (method_exists($actionClass, "getInstance")) ? $actionClass::getInstance() : new $actionClass;
24 24
         return $class;
25 25
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $expr = preg_quote($expr, '/');
106 106
         $expr = str_replace('###', '(.*)', $expr);
107 107
         $expr2 = preg_replace('/\(\.\*\)$/', '', $expr);
108
-        $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path);
108
+        $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path);
109 109
         return $matched;
110 110
     }
111 111
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public static function extractDomainInfo(\ReflectionClass $class, $domain)
118 118
     {
119
-        $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
120
-        $path = realpath($path) . DIRECTORY_SEPARATOR;
119
+        $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
120
+        $path = realpath($path).DIRECTORY_SEPARATOR;
121 121
         $tpl_path = "templates";
122 122
         $public_path = "public";
123 123
         $model_path = "models";
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
             $model_path = ucfirst($model_path);
128 128
         }
129 129
         if ($class->hasConstant("TPL")) {
130
-            $tpl_path .= DIRECTORY_SEPARATOR . $class->getConstant("TPL");
130
+            $tpl_path .= DIRECTORY_SEPARATOR.$class->getConstant("TPL");
131 131
         }
132 132
         return [
133
-            "template" => $path . $tpl_path,
134
-            "model" => $path . $model_path,
135
-            "public" => $path . $public_path,
133
+            "template" => $path.$tpl_path,
134
+            "model" => $path.$model_path,
135
+            "public" => $path.$public_path,
136 136
         ];
137 137
     }
138 138
 
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
         if (count($parameters) > 0) foreach ($parameters as $param) {
155 155
             if ($param->isOptional() && !is_array($param->getDefaultValue())) {
156 156
                 $params[$param->getName()] = $param->getDefaultValue();
157
-                $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex);
157
+                $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue(), $regex);
158 158
             }
159
-        } else $default = $regex;
159
+        }else $default = $regex;
160 160
 
161 161
         return array($regex, $default, $params);
162 162
     }
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $is_enabled = true;
213 213
         // For non api routes
214
-        if(strlen($api) > 0 && preg_match('/admin/i', $route)) {
214
+        if (strlen($api) > 0 && preg_match('/admin/i', $route)) {
215 215
             // If route is for api, check if admin is enabled in config
216 216
             $admin_enabled = Config::getInstance()->get('api.admin');
217
-            if(empty($admin_enabled)) {
217
+            if (empty($admin_enabled)) {
218 218
                 $is_enabled = false;
219 219
             }
220 220
         }
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
                 $default = str_replace('{__API__}', $api, $default);
239 239
             }
240 240
             $httpMethod = RouterHelper::extractReflectionHttpMethod($docComments);
241
-            if(self::checkCanAddRoute($regex, $api)) {
242
-                $route = $httpMethod . "#|#" . $regex;
241
+            if (self::checkCanAddRoute($regex, $api)) {
242
+                $route = $httpMethod."#|#".$regex;
243 243
                 $info = [
244 244
                     "method" => $method->getName(),
245 245
                     "params" => $params,
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,8 +56,10 @@  discard block
 block discarded – undo
56 56
         $_route = explode("/", $url['path']);
57 57
         $_pattern = explode("/", $pattern);
58 58
         $get = array();
59
-        if (!empty($_pattern)) foreach ($_pattern as $index => $component) {
59
+        if (!empty($_pattern)) {
60
+            foreach ($_pattern as $index => $component) {
60 61
             $_get = array();
62
+        }
61 63
             preg_match_all('/^\{(.*)\}$/i', $component, $_get);
62 64
             if (!empty($_get[1]) && isset($_route[$index])) {
63 65
                 $get[array_pop($_get[1])] = $_route[$index];
@@ -151,12 +153,16 @@  discard block
 block discarded – undo
151 153
         $params = [];
152 154
         $parameters = $method->getParameters();
153 155
         /** @var \ReflectionParameter $param */
154
-        if (count($parameters) > 0) foreach ($parameters as $param) {
156
+        if (count($parameters) > 0) {
157
+            foreach ($parameters as $param) {
155 158
             if ($param->isOptional() && !is_array($param->getDefaultValue())) {
156 159
                 $params[$param->getName()] = $param->getDefaultValue();
160
+        }
157 161
                 $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex);
158 162
             }
159
-        } else $default = $regex;
163
+        } else {
164
+            $default = $regex;
165
+        }
160 166
 
161 167
         return array($regex, $default, $params);
162 168
     }
Please login to merge, or discard this patch.
src/services/AdminServices.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
     use PSFS\base\config\Config;
5 5
     use PSFS\base\Security;
6 6
     use PSFS\base\Service;
7
-    use PSFS\controller\Admin;
8 7
     use Symfony\Component\Finder\Finder;
9 8
 
10 9
     class AdminServices extends Service{
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     use PSFS\controller\Admin;
8 8
     use Symfony\Component\Finder\Finder;
9 9
 
10
-    class AdminServices extends Service{
10
+    class AdminServices extends Service {
11 11
 
12 12
         /**
13 13
          * @Inyectable
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         {
34 34
             $platform = trim(Config::getInstance()->get("platform_name"));
35 35
             header('HTTP/1.1 401 Unauthorized');
36
-            header('WWW-Authenticate: Basic Realm="' . $platform. '"');
36
+            header('WWW-Authenticate: Basic Realm="'.$platform.'"');
37 37
             echo _("Zona restringida");
38 38
             exit();
39 39
         }
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
         public function getAdmins()
46 46
         {
47 47
             $admins = $this->security->getAdmins();
48
-            if(!empty($admins))
48
+            if (!empty($admins))
49 49
             {
50
-                if(!$this->security->checkAdmin())
50
+                if (!$this->security->checkAdmin())
51 51
                 {
52 52
                     $this->setAdminHeaders();
53 53
                 }
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
          */
63 63
         private function parseAdmins(&$admins)
64 64
         {
65
-            if(!empty($admins)) foreach($admins as &$admin)
65
+            if (!empty($admins)) foreach ($admins as &$admin)
66 66
             {
67
-                if(isset($admin["profile"]))
67
+                if (isset($admin["profile"]))
68 68
                 {
69
-                    switch($admin["profile"]) {
69
+                    switch ($admin["profile"]) {
70 70
                         case Security::MANAGER_ID_TOKEN: $admin['class'] = 'warning'; break;
71 71
                         case Security::ADMIN_ID_TOKEN: $admin['class'] = 'info'; break;
72 72
                         default:
73 73
                         case Security::USER_ID_TOKEN: $admin['class'] = 'primary'; break;
74 74
                     }
75
-                }else{
75
+                }else {
76 76
                     $admin["class"] = "primary";
77 77
                 }
78 78
             }
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
             $files->files()->in(LOG_DIR)->name("*.log")->sortByModifiedTime();
89 89
             $logs = array();
90 90
             /** @var \SplFileInfo $file */
91
-            foreach($files as $file)
91
+            foreach ($files as $file)
92 92
             {
93
-                $size = $file->getSize() / 8 / 1024;
93
+                $size = $file->getSize()/8/1024;
94 94
                 $time = date("c", $file->getMTime());
95 95
                 $dateTime = new \DateTime($time);
96
-                if(!isset($logs[$dateTime->format("Y")])) $logs[$dateTime->format("Y")] = array();
96
+                if (!isset($logs[$dateTime->format("Y")])) $logs[$dateTime->format("Y")] = array();
97 97
                 $logs[$dateTime->format("Y")][$dateTime->format("m")][$time] = array(
98 98
                     "filename" => $file->getFilename(),
99 99
                     "size" => round($size, 3)
@@ -117,27 +117,27 @@  discard block
 block discarded – undo
117 117
             $files->files()->in(LOG_DIR)->name($selectedLog);
118 118
             $file = null;
119 119
             $log = array();
120
-            foreach($files as $match)
120
+            foreach ($files as $match)
121 121
             {
122 122
                 $file = $match;
123 123
                 break;
124 124
             }
125 125
             /** @var \SplFileInfo $file */
126
-            if(!empty($file))
126
+            if (!empty($file))
127 127
             {
128 128
                 $time = date("c", $file->getMTime());
129 129
                 $dateTime = new \DateTime($time);
130 130
                 $monthOpen = $dateTime->format("m");
131
-                $content = file($file->getPath() . DIRECTORY_SEPARATOR . $file->getFilename());
131
+                $content = file($file->getPath().DIRECTORY_SEPARATOR.$file->getFilename());
132 132
                 krsort($content);
133 133
                 $detailLog = array();
134
-                foreach($content as &$line)
134
+                foreach ($content as &$line)
135 135
                 {
136 136
                     list($line, $detail) = $this->parseLogLine($line, $match);
137 137
                     $detailLog[] = array_merge(array(
138 138
                         "log" => $line,
139 139
                     ), $detail);
140
-                    if(count($detailLog) >= 1000) break;
140
+                    if (count($detailLog) >= 1000) break;
141 141
                 }
142 142
                 $log = $detailLog;
143 143
             }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
                 $type = (isset($match[1][0])) ? $match[1][0] : '';
168 168
                 $type = explode(".", $type);
169
-                $type = count($type)>1 ? $type[1] : $type[0];
169
+                $type = count($type) > 1 ? $type[1] : $type[0];
170 170
                 switch ($type) {
171 171
                     case 'INFO':
172 172
                         $detail["type"] = "success";
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
                         break;
183 183
                 }
184 184
 
185
-            } catch (\Exception $e) {
185
+            }catch (\Exception $e) {
186 186
                 $detail = array(
187 187
                     "type" => "danger",
188 188
                 );
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,17 +62,20 @@  discard block
 block discarded – undo
62 62
          */
63 63
         private function parseAdmins(&$admins)
64 64
         {
65
-            if(!empty($admins)) foreach($admins as &$admin)
65
+            if(!empty($admins)) {
66
+                foreach($admins as &$admin)
66 67
             {
67 68
                 if(isset($admin["profile"]))
68 69
                 {
69 70
                     switch($admin["profile"]) {
70
-                        case Security::MANAGER_ID_TOKEN: $admin['class'] = 'warning'; break;
71
+                        case Security::MANAGER_ID_TOKEN: $admin['class'] = 'warning';
72
+            }
73
+            break;
71 74
                         case Security::ADMIN_ID_TOKEN: $admin['class'] = 'info'; break;
72 75
                         default:
73 76
                         case Security::USER_ID_TOKEN: $admin['class'] = 'primary'; break;
74 77
                     }
75
-                }else{
78
+                } else{
76 79
                     $admin["class"] = "primary";
77 80
                 }
78 81
             }
@@ -93,7 +96,9 @@  discard block
 block discarded – undo
93 96
                 $size = $file->getSize() / 8 / 1024;
94 97
                 $time = date("c", $file->getMTime());
95 98
                 $dateTime = new \DateTime($time);
96
-                if(!isset($logs[$dateTime->format("Y")])) $logs[$dateTime->format("Y")] = array();
99
+                if(!isset($logs[$dateTime->format("Y")])) {
100
+                    $logs[$dateTime->format("Y")] = array();
101
+                }
97 102
                 $logs[$dateTime->format("Y")][$dateTime->format("m")][$time] = array(
98 103
                     "filename" => $file->getFilename(),
99 104
                     "size" => round($size, 3)
@@ -137,7 +142,9 @@  discard block
 block discarded – undo
137 142
                     $detailLog[] = array_merge(array(
138 143
                         "log" => $line,
139 144
                     ), $detail);
140
-                    if(count($detailLog) >= 1000) break;
145
+                    if(count($detailLog) >= 1000) {
146
+                        break;
147
+                    }
141 148
                 }
142 149
                 $log = $detailLog;
143 150
             }
@@ -161,7 +168,9 @@  discard block
 block discarded – undo
161 168
 
162 169
                     $detail = json_decode($match[0][0], TRUE);
163 170
                 }
164
-                if (empty($detail)) $detail = array();
171
+                if (empty($detail)) {
172
+                    $detail = array();
173
+                }
165 174
                 preg_match_all('/\>\ (.*):/i', $line, $match);
166 175
 
167 176
                 $type = (isset($match[1][0])) ? $match[1][0] : '';
Please login to merge, or discard this patch.
src/base/Router.php 2 patches
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 previus exception');
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,14 +137,14 @@  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) {
143
+        }catch (RouterException $r) {
144 144
             if (FALSE !== preg_match('/\/$/', $route)) {
145 145
                 if (preg_match('/admin/', $route)) {
146 146
                     $default = Config::getInstance()->get('admin_action') ?: 'admin-login';
147
-                } else {
147
+                }else {
148 148
                     $default = Config::getInstance()->get('home_action');
149 149
                 }
150 150
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             }
153 153
             Logger::log($r->getMessage(), LOG_WARNING);
154 154
             throw $r;
155
-        } catch (\Exception $e) {
155
+        }catch (\Exception $e) {
156 156
             Logger::log($e->getMessage(), LOG_ERR);
157 157
             throw $e;
158 158
         }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     protected function searchAction($route)
171 171
     {
172
-        Logger::log('Searching action to execute: ' . $route, LOG_INFO);
172
+        Logger::log('Searching action to execute: '.$route, LOG_INFO);
173 173
         //Revisamos si tenemos la ruta registrada
174 174
         $parts = parse_url($route);
175 175
         $path = (array_key_exists('path', $parts)) ? $parts['path'] : $route;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                 $class = RouterHelper::getClassToCall($action);
184 184
                 try {
185 185
                     $this->executeCachedRoute($route, $action, $class, $get);
186
-                } catch (\Exception $e) {
186
+                }catch (\Exception $e) {
187 187
                     Logger::log($e->getMessage(), LOG_ERR);
188 188
                     throw new RouterException($e->getMessage(), 404, $e);
189 189
                 }
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
         $this->routing = $this->inspectDir($base, "PSFS", array());
212 212
         if (file_exists($modules)) {
213 213
             $module = "";
214
-            if(file_exists($modules . DIRECTORY_SEPARATOR . 'module.json')) {
215
-                $mod_cfg = json_decode(file_get_contents($modules . DIRECTORY_SEPARATOR . 'module.json'), true);
214
+            if (file_exists($modules.DIRECTORY_SEPARATOR.'module.json')) {
215
+                $mod_cfg = json_decode(file_get_contents($modules.DIRECTORY_SEPARATOR.'module.json'), true);
216 216
                 $module = $mod_cfg['module'];
217 217
             }
218 218
             $this->routing = $this->inspectDir($modules, $module, $this->routing);
219 219
         }
220
-        $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->domains, Cache::JSON, TRUE);
220
+        $this->cache->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", $this->domains, Cache::JSON, TRUE);
221 221
     }
222 222
 
223 223
     /**
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $home_params = NULL;
233 233
             foreach ($this->routing as $pattern => $params) {
234 234
                 list($method, $route) = RouterHelper::extractHttpRoute($pattern);
235
-                if (preg_match("/" . preg_quote($route, "/") . "$/i", "/" . $home)) {
235
+                if (preg_match("/".preg_quote($route, "/")."$/i", "/".$home)) {
236 236
                     $home_params = $params;
237 237
                 }
238 238
             }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         $files = $this->finder->files()->in($origen)->path('/(controller|api)/i')->name("*.php");
258 258
         foreach ($files as $file) {
259 259
             $filename = str_replace("/", '\\', str_replace($origen, '', $file->getPathname()));
260
-            $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing);
260
+            $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing);
261 261
         }
262 262
         $this->finder = new Finder();
263 263
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
                 }
297 297
                 foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
298 298
                     list($route, $info) = RouterHelper::extractRouteInfo($method, $api);
299
-                    if(null !== $route && null !== $info) {
299
+                    if (null !== $route && null !== $info) {
300 300
                         $info['class'] = $namespace;
301 301
                         $routing[$route] = $info;
302 302
                     }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     {
320 320
         //Calculamos los dominios para las plantillas
321 321
         if ($class->hasConstant("DOMAIN")) {
322
-            $domain = "@" . $class->getConstant("DOMAIN") . "/";
322
+            $domain = "@".$class->getConstant("DOMAIN")."/";
323 323
             $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain);
324 324
         }
325 325
 
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
      */
333 333
     public function simpatize()
334 334
     {
335
-        $translationFileName = "translations" . DIRECTORY_SEPARATOR . "routes_translations.php";
336
-        $absoluteTranslationFileName = CACHE_DIR . DIRECTORY_SEPARATOR . $translationFileName;
335
+        $translationFileName = "translations".DIRECTORY_SEPARATOR."routes_translations.php";
336
+        $absoluteTranslationFileName = CACHE_DIR.DIRECTORY_SEPARATOR.$translationFileName;
337 337
         $this->generateSlugs($absoluteTranslationFileName);
338 338
         Config::createDir(CONFIG_DIR);
339
-        Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE);
339
+        Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE);
340 340
 
341 341
         return $this;
342 342
     }
@@ -387,16 +387,16 @@  discard block
 block discarded – undo
387 387
     public function getRoute($slug = '', $absolute = FALSE, $params = [])
388 388
     {
389 389
         if (strlen($slug) === 0) {
390
-            return ($absolute) ? Request::getInstance()->getRootUrl() . '/' : '/';
390
+            return ($absolute) ? Request::getInstance()->getRootUrl().'/' : '/';
391 391
         }
392 392
         if (NULL === $slug || !array_key_exists($slug, $this->slugs)) {
393 393
             throw new RouterException(_("No existe la ruta especificada"));
394 394
         }
395
-        $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug];
395
+        $url = ($absolute) ? Request::getInstance()->getRootUrl().$this->slugs[$slug] : $this->slugs[$slug];
396 396
         if (!empty($params)) foreach ($params as $key => $value) {
397
-            $url = str_replace("{" . $key . "}", $value, $url);
397
+            $url = str_replace("{".$key."}", $value, $url);
398 398
         } elseif (!empty($this->routing[$this->slugs[$slug]]["default"])) {
399
-            $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
399
+            $url = ($absolute) ? Request::getInstance()->getRootUrl().$this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
400 400
         }
401 401
 
402 402
         return preg_replace('/(GET|POST|PUT|DELETE|ALL)\#\|\#/', '', $url);
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
             if (preg_match('/^\/admin(\/|$)/', $routePattern)) {
415 415
                 if (preg_match('/^\\\?PSFS/', $params["class"])) {
416 416
                     $profile = "superadmin";
417
-                } else {
417
+                }else {
418 418
                     $profile = "admin";
419 419
                 }
420 420
                 if (!empty($params["default"]) && preg_match('/(GET|ALL)/i', $httpMethod)) {
@@ -466,17 +466,17 @@  discard block
 block discarded – undo
466 466
      */
467 467
     protected function executeCachedRoute($route, $action, $class, $params = NULL)
468 468
     {
469
-        Logger::log('Executing route ' . $route, LOG_INFO);
469
+        Logger::log('Executing route '.$route, LOG_INFO);
470 470
         Security::getInstance()->setSessionKey("__CACHE__", $action);
471 471
         $cache = Cache::needCache();
472 472
         $execute = TRUE;
473 473
         if (FALSE !== $cache && Config::getInstance()->getDebugMode() === FALSE) {
474 474
             $cacheDataName = $this->cache->getRequestCacheHash();
475
-            $cachedData = $this->cache->readFromCache("templates" . DIRECTORY_SEPARATOR . $cacheDataName,
476
-                $cache, function () {});
475
+            $cachedData = $this->cache->readFromCache("templates".DIRECTORY_SEPARATOR.$cacheDataName,
476
+                $cache, function() {});
477 477
             if (NULL !== $cachedData) {
478
-                $headers = $this->cache->readFromCache("templates" . DIRECTORY_SEPARATOR . $cacheDataName . ".headers",
479
-                    $cache, function () {}, Cache::JSON);
478
+                $headers = $this->cache->readFromCache("templates".DIRECTORY_SEPARATOR.$cacheDataName.".headers",
479
+                    $cache, function() {}, Cache::JSON);
480 480
                 Template::getInstance()->renderCache($cachedData, $headers);
481 481
                 $execute = FALSE;
482 482
             }
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
         $translations = array();
523 523
         if (file_exists($absoluteTranslationFileName)) {
524 524
             include($absoluteTranslationFileName);
525
-        } else {
525
+        }else {
526 526
             Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE);
527 527
         }
528 528
 
Please login to merge, or discard this patch.
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.
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.