Completed
Push — master ( 4036d4...da82e8 )
by Fran
03:44
created
src/base/dto/Form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         {
22 22
             $array = array();
23 23
             $array['fields'] = array();
24
-            foreach($this->fields as $field) {
24
+            foreach ($this->fields as $field) {
25 25
                 $array['fields'][] = $field->__toArray();
26 26
             }
27 27
             return $array;
Please login to merge, or discard this patch.
src/base/types/AuthApi.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
         {
27 27
             $namespace = explode('\\', $this->getModelTableMap());
28 28
             $module = strtolower($namespace[0]);
29
-            $secret = Config::getInstance()->get($module . '.api.secret');
29
+            $secret = Config::getInstance()->get($module.'.api.secret');
30 30
             if (NULL === $secret) {
31 31
                 $secret = Config::getInstance()->get("api.secret");
32 32
             }
33 33
             if (NULL === $secret) {
34 34
                 $auth = TRUE;
35
-            } else {
35
+            }else {
36 36
                 $token = Request::getInstance()->getHeader('X-API-SEC-TOKEN');
37 37
                 if (array_key_exists('API_TOKEN', $this->query)) {
38 38
                     $token = $this->query['API_TOKEN'];
Please login to merge, or discard this patch.
src/base/types/interfaces/AuthInterface.php 1 patch
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -7,7 +7,19 @@
 block discarded – undo
7 7
  * @package PSFS\base\types\interfaces
8 8
  */
9 9
 interface AuthInterface {
10
+
11
+    /**
12
+     * @return boolean
13
+     */
10 14
     function isLogged();
15
+
16
+    /**
17
+     * @return boolean
18
+     */
11 19
     function isAdmin();
20
+
21
+    /**
22
+     * @return boolean
23
+     */
12 24
     function canDo($action);
13 25
 }
Please login to merge, or discard this patch.
src/base/types/interfaces/ControllerInterface.php 1 patch
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -7,6 +7,14 @@
 block discarded – undo
7 7
  * @package PSFS\base\types\interfaces
8 8
  */
9 9
 interface ControllerInterface {
10
+
11
+    /**
12
+     * @return string|null
13
+     */
10 14
     public function render($template, Array $vars = null);
15
+
16
+    /**
17
+     * @return void
18
+     */
11 19
     public function response($response, $type = 'text/html');
12 20
 }
Please login to merge, or discard this patch.
src/services/GeneratorService.php 3 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     use PSFS\base\config\Config;
6 6
     use PSFS\base\Service;
7 7
 
8
-    class GeneratorService extends Service{
8
+    class GeneratorService extends Service {
9 9
         /**
10 10
          * @Inyectable
11 11
          * @var \PSFS\base\config\Config Servicio de configuración
@@ -30,25 +30,25 @@  discard block
 block discarded – undo
30 30
          */
31 31
         public static function findTranslations($path, $locale)
32 32
         {
33
-            $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
34
-            $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR;
33
+            $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
34
+            $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR;
35 35
 
36 36
             $translations = array();
37
-            if(file_exists($path))
37
+            if (file_exists($path))
38 38
             {
39 39
                 $d = dir($path);
40
-                while(false !== ($dir = $d->read()))
40
+                while (false !== ($dir = $d->read()))
41 41
                 {
42 42
                     Config::createDir($locale_path);
43
-                    if(!file_exists($locale_path . 'translations.po')) {
44
-                        file_put_contents($locale_path . 'translations.po', '');
43
+                    if (!file_exists($locale_path.'translations.po')) {
44
+                        file_put_contents($locale_path.'translations.po', '');
45 45
                     }
46 46
                     $inspect_path = realpath($path.DIRECTORY_SEPARATOR.$dir);
47
-                    $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ". $inspect_path . DIRECTORY_SEPARATOR ."*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po";
48
-                    if(is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./',$dir) == 0)
47
+                    $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ".$inspect_path.DIRECTORY_SEPARATOR."*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po";
48
+                    if (is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./', $dir) == 0)
49 49
                     {
50
-                        $res = _('Revisando directorio: ') . $inspect_path;
51
-                        $res .= _('Comando ejecutado: '). $cmd_php;
50
+                        $res = _('Revisando directorio: ').$inspect_path;
51
+                        $res .= _('Comando ejecutado: ').$cmd_php;
52 52
                         $res .= shell_exec($cmd_php);
53 53
                         usleep(10);
54 54
                         $translations[] = $res;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
          */
69 69
         public function createStructureModule($module, $force = false, $type = "")
70 70
         {
71
-            $mod_path = CORE_DIR . DIRECTORY_SEPARATOR;
71
+            $mod_path = CORE_DIR.DIRECTORY_SEPARATOR;
72 72
             $module = ucfirst($module);
73 73
             $this->createModulePath($module, $mod_path);
74 74
             $this->createModulePathTree($module, $mod_path);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             //Creamos el directorio base de los módulos
90 90
             Config::createDir($mod_path);
91 91
             //Creamos la carpeta del módulo
92
-            Config::createDir($mod_path . $module);
92
+            Config::createDir($mod_path.$module);
93 93
         }
94 94
 
95 95
         /**
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
             //Creamos las carpetas CORE del módulo
103 103
             $this->log->infoLog("Generamos la estructura");
104 104
             $paths = array("Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test");
105
-            foreach($paths as $path) {
106
-                Config::createDir($mod_path . $module . DIRECTORY_SEPARATOR . $path);
105
+            foreach ($paths as $path) {
106
+                Config::createDir($mod_path.$module.DIRECTORY_SEPARATOR.$path);
107 107
             }
108 108
             //Creamos las carpetas de los assets
109 109
             $htmlPaths = array("css", "js", "img", "media", "font");
110
-            foreach($htmlPaths as $path) {
111
-                Config::createDir($mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path);
110
+            foreach ($htmlPaths as $path) {
111
+                Config::createDir($mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path);
112 112
             }
113 113
         }
114 114
 
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
         private function createModuleModels($module)
139 139
         {
140 140
             //Generamos las clases de propel y la configuración
141
-            $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel ";
142
-            $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config";
143
-            $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config --output-dir=" . CORE_DIR . " --verbose";
144
-            $ret = shell_exec($exec . "build" . $opt . $schemaOpt);
141
+            $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR."vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel ";
142
+            $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config";
143
+            $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config --output-dir=".CORE_DIR." --verbose";
144
+            $ret = shell_exec($exec."build".$opt.$schemaOpt);
145 145
 
146 146
             $this->log->infoLog("Generamos clases invocando a propel:\n $ret");
147
-            $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config" . $schemaOpt);
147
+            $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config".$schemaOpt);
148 148
             $this->log->infoLog("Generamos sql invocando a propel:\n $ret");
149
-            $ret = shell_exec($exec . "config:convert" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config");
149
+            $ret = shell_exec($exec."config:convert".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config");
150 150
             $this->log->infoLog("Generamos configuración invocando a propel:\n $ret");
151 151
         }
152 152
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 "module" => $module,
166 166
                 "controllerType" => $controllerType,
167 167
             ));
168
-            return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Controller" . DIRECTORY_SEPARATOR . "{$module}Controller.php", $force);
168
+            return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Controller".DIRECTORY_SEPARATOR."{$module}Controller.php", $force);
169 169
         }
170 170
 
171 171
         /**
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
         private function generateBaseApiTemplate($module, $mod_path, $force = false, $controllerType = "")
179 179
         {
180 180
             $created = true;
181
-            $modelPath = $mod_path . $module . DIRECTORY_SEPARATOR . 'Models';
182
-            if(file_exists($modelPath)) {
181
+            $modelPath = $mod_path.$module.DIRECTORY_SEPARATOR.'Models';
182
+            if (file_exists($modelPath)) {
183 183
                 $dir = dir($modelPath);
184
-                while($file = $dir->read()) {
185
-                    if(!in_array($file, array('.', '..')) && !preg_match('/Query\.php$/i', $file) && preg_match('/\.php$/i', $file)) {
184
+                while ($file = $dir->read()) {
185
+                    if (!in_array($file, array('.', '..')) && !preg_match('/Query\.php$/i', $file) && preg_match('/\.php$/i', $file)) {
186 186
                         $filename = str_replace(".php", "", $file);
187 187
                         $this->log->infoLog("Generamos Api BASES para {$filename}");
188 188
                         $this->createApiBaseFile($module, $mod_path, $filename);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         {
204 204
             //Generamos el fichero de configuración
205 205
             $this->log->infoLog("Generamos fichero vacío de configuración");
206
-            return $this->writeTemplateToFile("<?php\n\t", $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", $force);
206
+            return $this->writeTemplateToFile("<?php\n\t", $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", $force);
207 207
         }
208 208
 
209 209
         /**
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
         {
217 217
             //Generamos el fichero de configuración
218 218
             $this->log->infoLog("Generamos ficheros para assets base");
219
-            $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", $mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css", false);
220
-            $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", $mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js", false);
219
+            $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", $mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css", false);
220
+            $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", $mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js", false);
221 221
             return ($css && $js);
222 222
         }
223 223
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             $controller = $this->tpl->dump("generator/service.template.twig", array(
235 235
                 "module" => $module,
236 236
             ));
237
-            return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$module}Service.php", $force);
237
+            return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$module}Service.php", $force);
238 238
         }
239 239
 
240 240
         /**
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             $autoloader = $this->tpl->dump("generator/autoloader.template.twig", array(
251 251
                 "module" => $module,
252 252
             ));
253
-            return $this->writeTemplateToFile($autoloader, $mod_path . $module . DIRECTORY_SEPARATOR . "autoload.php", $force);
253
+            return $this->writeTemplateToFile($autoloader, $mod_path.$module.DIRECTORY_SEPARATOR."autoload.php", $force);
254 254
         }
255 255
 
256 256
         /**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                 "module" => $module,
268 268
                 "db"     => $this->config->get("db_name"),
269 269
             ));
270
-            return $this->writeTemplateToFile($schema, $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", $force);
270
+            return $this->writeTemplateToFile($schema, $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", $force);
271 271
         }
272 272
 
273 273
         /**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                 "pass"   => $this->config->get("db_password"),
288 288
                 "db"     => $this->config->get("db_name"),
289 289
             ));
290
-            return $this->writeTemplateToFile($build_properties, $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml", $force);
290
+            return $this->writeTemplateToFile($build_properties, $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml", $force);
291 291
         }
292 292
 
293 293
         /**
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             $index = $this->tpl->dump("generator/index.template.twig", array(
304 304
                 "module" => $module,
305 305
             ));
306
-            return $this->writeTemplateToFile($index, $mod_path . $module . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", $force);
306
+            return $this->writeTemplateToFile($index, $mod_path.$module.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", $force);
307 307
         }
308 308
 
309 309
         /**
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
             $created = false;
318 318
             if ($force || !file_exists($filename)) {
319 319
                 try {
320
-                    $this->cache->storeData($filename, $fileContent, Cache::TEXT,true);
320
+                    $this->cache->storeData($filename, $fileContent, Cache::TEXT, true);
321 321
                     $created = true;
322
-                } catch(\Exception $e) {
322
+                }catch (\Exception $e) {
323 323
                     $this->log->errorLog($e->getMessage());
324 324
                 }
325
-            } else{
326
-                $this->log->errorLog($filename . _(' not exists or cant write'));
325
+            }else {
326
+                $this->log->errorLog($filename._(' not exists or cant write'));
327 327
             }
328 328
             return $created;
329 329
         }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                 "api"            => $api
344 344
             ));
345 345
 
346
-            return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
346
+            return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Api".DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
347 347
         }
348 348
 
349 349
         /**
@@ -362,6 +362,6 @@  discard block
 block discarded – undo
362 362
                 "api"            => $api
363 363
             ));
364 364
 
365
-            return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . "{$api}.php", $force);
365
+            return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Api".DIRECTORY_SEPARATOR."{$api}.php", $force);
366 366
         }
367 367
     }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
         /**
27 27
          * Método que revisa las traducciones directorio a directorio
28
-         * @param $path
28
+         * @param string $path
29 29
          * @param $locale
30 30
          * @return array
31 31
          */
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 
96 96
         /**
97 97
          * Servicio que genera la estructura base
98
-         * @param $module
99
-         * @param $mod_path
98
+         * @param string $module
99
+         * @param string $mod_path
100 100
          */
101 101
         private function createModulePathTree($module, $mod_path)
102 102
         {
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
          * Method that copy resources recursively
371 371
          * @param string $dest
372 372
          * @param boolean $force
373
-         * @param $filename_path
373
+         * @param string $filename_path
374 374
          * @param boolean $debug
375 375
          */
376 376
         public static function copyResources($dest, $force, $filename_path, $debug)
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -380,7 +380,7 @@
 block discarded – undo
380 380
                 if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) {
381 381
                     if (is_dir($filename_path)) {
382 382
                         self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
383
-                    }else {
383
+                    } else {
384 384
                         if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
385 385
                             throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
386 386
                         }
Please login to merge, or discard this patch.
src/services/DocumentorService.php 3 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.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -422,7 +422,7 @@
 block discarded – undo
422 422
                                 "type" => $type,
423 423
                             ];
424 424
                             if (strlen($format)) {
425
-                               $dto['properties'][$field]['format'] = $format;
425
+                                $dto['properties'][$field]['format'] = $format;
426 426
                             }
427 427
                         }
428 428
                     }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                         if (!preg_match('/^\@ROOT/i', $domain)) {
34 34
                             $modules[] = str_replace('/', '', str_replace('@', '', $domain));
35 35
                         }
36
-                    } catch (\Exception $e) {
36
+                    }catch (\Exception $e) {
37 37
                         $modules[] = $e->getMessage();
38 38
                     }
39 39
                 }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
          */
52 52
         public function extractApiEndpoints($module)
53 53
         {
54
-            $module_path = CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Api";
54
+            $module_path = CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Api";
55 55
             $endpoints = [];
56 56
             if (file_exists($module_path)) {
57 57
                 $finder = new Finder();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 if (count($finder)) {
60 60
                     /** @var \SplFileInfo $file */
61 61
                     foreach ($finder as $file) {
62
-                        $namespace = "\\{$module}\\Api\\" . str_replace('.php', '', $file->getFilename());
62
+                        $namespace = "\\{$module}\\Api\\".str_replace('.php', '', $file->getFilename());
63 63
                         $endpoints[$namespace] = $this->extractApiInfo($namespace);
64 64
                     }
65 65
                 }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                         if (NULL !== $mInfo) {
89 89
                             $info[] = $mInfo;
90 90
                         }
91
-                    } catch (\Exception $e) {
91
+                    }catch (\Exception $e) {
92 92
                         Logger::getInstance()->errorLog($e->getMessage());
93 93
                     }
94 94
                 }
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
             if ($reflector->isSubclassOf(self::DTO_INTERFACE)) {
222 222
                 foreach ($reflector->getProperties(\ReflectionMethod::IS_PUBLIC) as $property) {
223 223
                     $type = $this->extractVarType($property->getDocComment());
224
-                    if(class_exists($type)) {
224
+                    if (class_exists($type)) {
225 225
                         $properties[$property->getName()] = $this->extractModelFields($type);
226
-                    } else {
226
+                    }else {
227 227
                         $properties[$property->getName()] = $type;
228 228
                     }
229 229
                 }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
          */
243 243
         protected function extractReturn($model, $comments = '')
244 244
         {
245
-            $modelDto  = [];
245
+            $modelDto = [];
246 246
             preg_match('/\@return\ (.*)\((.*)\)\n/i', $comments, $returnTypes);
247 247
             if (count($returnTypes)) {
248 248
                 // Extract principal DTO information
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                 } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) {
296 296
                     $payload = $this->extractDtoProperties($namespace);
297 297
                 }
298
-            } catch (\Exception $e) {
298
+            }catch (\Exception $e) {
299 299
                 Logger::getInstance()->errorLog($e->getMessage());
300 300
             }
301 301
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
                         if (in_array($methodInfo['method'], ['POST', 'PUT'])) {
332 332
                             $methodInfo['payload'] = $this->extractPayload($modelNamespace, $docComments);
333 333
                         }
334
-                    } catch (\Exception $e) {
334
+                    }catch (\Exception $e) {
335 335
                         jpre($e->getMessage());
336 336
                         Logger::getInstance()->errorLog($e->getMessage());
337 337
                     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
          */
350 350
         public static function translateSwaggerFormats($format)
351 351
         {
352
-            switch(strtolower($format)) {
352
+            switch (strtolower($format)) {
353 353
                 case 'bool':
354 354
                 case 'boolean':
355 355
                     $swaggerType = 'boolean';
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
                             ]]);
411 411
                             if (array_key_exists($subDtoName, $subDto)) {
412 412
                                 $definitions = $subDto;
413
-                            } else {
413
+                            }else {
414 414
                                 $definitions[$subDtoName] = $subDto;
415 415
                             }
416 416
                             $dto['properties'][$field] = [
417
-                                '$ref' => "#/definitions/" . $subDtoName,
417
+                                '$ref' => "#/definitions/".$subDtoName,
418 418
                             ];
419
-                        } else {
419
+                        }else {
420 420
                             list($type, $format) = self::translateSwaggerFormats($format);
421 421
                             $dto['properties'][$field] = [
422 422
                                 "type" => $type,
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
                     "url" => Router::getInstance()->getRoute(''),
454 454
                 ]
455 455
             ];
456
-            foreach($endpoints as $model) {
456
+            foreach ($endpoints as $model) {
457 457
                 foreach ($model as $endpoint) {
458 458
                     $dtos += self::extractSwaggerDefinition($endpoint);
459 459
                 }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         protected function extractDtoName($dto, $isArray = false)
473 473
         {
474 474
             $dto = explode('\\', $dto);
475
-            $modelDto = array_pop($dto) . "Dto";
475
+            $modelDto = array_pop($dto)."Dto";
476 476
             if ($isArray) {
477 477
                 $modelDto .= "List";
478 478
             }
Please login to merge, or discard this patch.
src/base/Logger.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         /**
71 71
          * Método que escribe un log de Error
72
-         * @param $msg
72
+         * @param string $msg
73 73
          * @param array $context
74 74
          *
75 75
          * @return bool
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         /**
82 82
          * Método que escribe un log de Warning
83
-         * @param $msg
83
+         * @param string $msg
84 84
          * @param array $context
85 85
          * @return bool
86 86
          */
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -6,10 +6,8 @@
 block discarded – undo
6 6
     use Monolog\Handler\FirePHPHandler;
7 7
     use Monolog\Handler\StreamHandler;
8 8
     use Monolog\Logger as Monolog;
9
-    use Monolog\Processor\GitProcessor;
10 9
     use Monolog\Processor\MemoryUsageProcessor;
11 10
     use Monolog\Processor\UidProcessor;
12
-    use Monolog\Processor\WebProcessor;
13 11
     use PSFS\base\config\Config;
14 12
     use PSFS\base\types\SingletonTrait;
15 13
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@
 block discarded – undo
190 190
          * @param array $context
191 191
          */
192 192
         public static function log($msg, $type = LOG_DEBUG, $context = []) {
193
-            switch($type) {
193
+            switch ($type) {
194 194
                 case LOG_DEBUG:
195 195
                     Logger::getInstance()->debugLog($msg, $context);
196 196
                     break;
Please login to merge, or discard this patch.
src/bootstrap.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-    if(defined('PSFS_BOOTSTRAP_LOADED')) return;
2
+    if (defined('PSFS_BOOTSTRAP_LOADED')) return;
3 3
     use Symfony\Component\Finder\Finder;
4 4
 
5 5
     if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__);
Please login to merge, or discard this patch.
Braces   +32 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,20 +1,40 @@
 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 11
     {
8
-        if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');
9
-        if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src');
10
-    }else {
11
-        if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..');
12
-        if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules');
13
-    }
14
-    if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
15
-    if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache');
16
-    if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config');
17
-    if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html');
12
+        if (!defined('BASE_DIR')) {
13
+            define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');
14
+        }
15
+        if (!defined('CORE_DIR')) {
16
+            define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src');
17
+        }
18
+    } else {
19
+        if (!defined('BASE_DIR')) {
20
+            define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..');
21
+        }
22
+        if (!defined('CORE_DIR')) {
23
+            define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules');
24
+        }
25
+    }
26
+    if (!defined('LOG_DIR')) {
27
+        define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
28
+    }
29
+    if (!defined('CACHE_DIR')) {
30
+        define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache');
31
+    }
32
+    if (!defined('CONFIG_DIR')) {
33
+        define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config');
34
+    }
35
+    if (!defined('WEB_DIR')) {
36
+        define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html');
37
+    }
18 38
 
19 39
     //Cargamos en memoria la función de desarrollo PRE
20 40
     if (!function_exists('pre')) {
Please login to merge, or discard this patch.
src/Dispatcher.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     use PSFS\base\Logger;
14 14
     use PSFS\base\Singleton;
15 15
 
16
-    require_once __DIR__ . DIRECTORY_SEPARATOR . "bootstrap.php";
16
+    require_once __DIR__.DIRECTORY_SEPARATOR."bootstrap.php";
17 17
 
18 18
     /**
19 19
      * Class Dispatcher
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
             Logger::log('Set locale to project');
77 77
             $this->locale = $this->config->get("default_language");
78 78
             // Load translations
79
-            putenv("LC_ALL=" . $this->locale);
79
+            putenv("LC_ALL=".$this->locale);
80 80
             setlocale(LC_ALL, $this->locale);
81 81
             // Load the locale path
82
-            $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale';
82
+            $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale';
83 83
             Config::createDir($locale_path);
84 84
             bindtextdomain('translations', $locale_path);
85 85
             textdomain('translations');
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
                     if (!$this->parser->isFile()) {
100 100
                         return $this->router->execute($this->actualUri);
101 101
                     }
102
-                } else {
102
+                }else {
103 103
                     return $this->router->getAdmin()->config();
104 104
                 }
105
-            } catch (ConfigException $c) {
105
+            }catch (ConfigException $c) {
106 106
                 return $this->dumpException($c);
107
-            } catch (SecurityException $s) {
107
+            }catch (SecurityException $s) {
108 108
                 return $this->security->notAuthorized($this->actualUri);
109
-            } catch (RouterException $r) {
109
+            }catch (RouterException $r) {
110 110
                 return $this->router->httpNotFound($r);
111
-            } catch (\Exception $e) {
111
+            }catch (\Exception $e) {
112 112
                 return $this->dumpException($e);
113 113
             }
114 114
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                     $use /= 1024;
151 151
                     break;
152 152
                 case "MBytes":
153
-                    $use /= (1024 * 1024);
153
+                    $use /= (1024*1024);
154 154
                     break;
155 155
                 case "Bytes":
156 156
                 default:
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             if ($this->config->getDebugMode()) {
177 177
                 Logger::log('Added handlers for errors');
178 178
                 //Warning & Notice handler
179
-                set_error_handler(function ($errno, $errstr, $errfile, $errline) {
179
+                set_error_handler(function($errno, $errstr, $errfile, $errline) {
180 180
                     Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline]);
181 181
                     throw new \Exception($errstr, 500);
182 182
                 });
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
         private function initiateStats()
190 190
         {
191 191
             Logger::log('Initialicing stats (mem + ts)');
192
-            if(null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) {
192
+            if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) {
193 193
                 $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT'];
194
-            } else {
194
+            }else {
195 195
                 $this->ts = $this->parser->getTs();
196 196
             }
197 197
             $this->mem = memory_get_usage();
Please login to merge, or discard this patch.