Passed
Push — master ( 2ee8d2...63175f )
by Fran
02:39
created
src/base/types/traits/Helper/OptionTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @return OptionTrait
49 49
      */
50 50
     public function dropOption($key) {
51
-        if(array_key_exists($key, $this->options)) {
51
+        if (array_key_exists($key, $this->options)) {
52 52
             unset($this->options[$key]);
53 53
         }
54 54
         return $this;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @return mixed|null
60 60
      */
61 61
     public function getOption($key) {
62
-        if(array_key_exists($key, $this->options)) {
62
+        if (array_key_exists($key, $this->options)) {
63 63
             return $this->options[$key];
64 64
         }
65 65
         return null;
Please login to merge, or discard this patch.
src/base/types/traits/CurlTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
     protected $isMultipart = false;
73 73
 
74 74
     protected function closeConnection() {
75
-        if(null !== $this->con) {
76
-            if(is_resource($this->con)) {
75
+        if (null !== $this->con) {
76
+            if (is_resource($this->con)) {
77 77
                 curl_close($this->con);
78
-            } else {
78
+            }else {
79 79
                 $this->setCon(null);
80 80
             }
81 81
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $this->params = [];
92 92
         $this->headers = [];
93 93
         $this->debug = 'debug' === strtolower(Config::getParam('log.level', 'notice'));
94
-        Logger::log('Context service for ' . static::class . ' cleared!');
94
+        Logger::log('Context service for '.static::class.' cleared!');
95 95
         $this->closeConnection();
96 96
     }
97 97
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         $this->clearContext();
101 101
         $con = curl_init($this->url);
102
-        if(is_resource($con)) {
102
+        if (is_resource($con)) {
103 103
             $this->setCon($con);
104 104
         }
105 105
     }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function setUrl($url, $cleanContext = true)
120 120
     {
121 121
         $this->url = $url;
122
-        if($cleanContext) {
122
+        if ($cleanContext) {
123 123
             $this->initialize();
124 124
         }
125 125
     }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function setIsJson($isJson = true) {
186 186
         $this->isJson = $isJson;
187
-        if($isJson) {
187
+        if ($isJson) {
188 188
             $this->setIsMultipart(false);
189 189
         }
190 190
     }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function setIsMultipart($isMultipart = true) {
203 203
         $this->isMultipart = $isMultipart;
204
-        if($isMultipart) {
204
+        if ($isMultipart) {
205 205
             $this->setIsJson(false);
206 206
         }
207 207
     }
Please login to merge, or discard this patch.
src/controller/UserController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 Logger::log('Configuration saved successful');
63 63
                 Security::getInstance()->setFlash("callback_message", t("Usuario agregado correctamente"));
64 64
                 Security::getInstance()->setFlash("callback_route", Router::getInstance()->getRoute("admin", true));
65
-            } else {
65
+            }else {
66 66
                 throw new ConfigException(t('Error al guardar los administradores, prueba a cambiar los permisos'));
67 67
             }
68 68
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         if ($this->isAdmin()) {
100 100
             return $this->redirect('admin');
101
-        } else {
101
+        }else {
102 102
             return Admin::staticAdminLogon($route);
103 103
         }
104 104
     }
Please login to merge, or discard this patch.
src/controller/base/Admin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@
 block discarded – undo
35 35
      */
36 36
     public static function staticAdminLogon($route = null)
37 37
     {
38
-        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json')) {
38
+        if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json')) {
39 39
             return AdminServices::getInstance()->setAdminHeaders();
40
-        } else {
40
+        }else {
41 41
             return UserController::showAdminManager();
42 42
         }
43 43
     }
Please login to merge, or discard this patch.
src/base/types/traits/BoostrapTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace PSFS\base\types\traits;
3 3
 
4
-if(!defined('PSFS_BOOSTRAP_TRAT_LOADED')) {
4
+if (!defined('PSFS_BOOSTRAP_TRAT_LOADED')) {
5 5
     /**
6 6
      * Class BoostrapTrait
7 7
      * @package PSFS\base\types
@@ -10,5 +10,5 @@  discard block
 block discarded – undo
10 10
     {
11 11
     }
12 12
     define('PSFS_BOOSTRAP_TRAT_LOADED', true);
13
-    require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php';
13
+    require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php';
14 14
 }
Please login to merge, or discard this patch.
src/base/dto/Order.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         if (preg_match('/^asc$/i', $direction)) {
64 64
             return self::ASC;
65
-        } else {
65
+        }else {
66 66
             return self::DESC;
67 67
         }
68 68
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function fromArray(array $object = [])
83 83
     {
84
-        foreach($object as $field => $order) {
84
+        foreach ($object as $field => $order) {
85 85
             $this->addOrder($field, $order);
86 86
         }
87 87
     }
Please login to merge, or discard this patch.
src/base/dto/Dto.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function __construct($hydrate = true)
20 20
     {
21 21
         parent::__construct();
22
-        if($hydrate) {
22
+        if ($hydrate) {
23 23
             $this->fromArray(Request::getInstance()->getData());
24 24
         }
25 25
     }
@@ -47,23 +47,23 @@  discard block
 block discarded – undo
47 47
                 /** @var \ReflectionProperty $property */
48 48
                 foreach ($properties as $property) {
49 49
                     $value = $property->getValue($this);
50
-                    if(is_object($value) && method_exists($value, 'toArray')) {
50
+                    if (is_object($value) && method_exists($value, 'toArray')) {
51 51
                         $dto[$property->getName()] = $value->toArray();
52
-                    } elseif(is_array($value)) {
53
-                        foreach($value as &$arrValue) {
54
-                            if($arrValue instanceof Dto) {
52
+                    } elseif (is_array($value)) {
53
+                        foreach ($value as &$arrValue) {
54
+                            if ($arrValue instanceof Dto) {
55 55
                                 $arrValue = $arrValue->toArray();
56 56
                             }
57 57
                         }
58 58
                         $dto[$property->getName()] = $value;
59
-                    } else {
59
+                    }else {
60 60
                         $type = InjectorHelper::extractVarType($property->getDocComment());
61 61
                         $dto[$property->getName()] = $this->checkCastedValue($property->getValue($this), $type);
62 62
                     }
63 63
                 }
64 64
             }
65
-        } catch (\Exception $e) {
66
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
65
+        }catch (\Exception $e) {
66
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
67 67
         }
68 68
         return $dto;
69 69
     }
@@ -86,26 +86,26 @@  discard block
 block discarded – undo
86 86
     protected function parseDtoField(array $properties, $key, $value = null) {
87 87
         list($type, $isArray) = $this->extractTypes($properties, $key);
88 88
         $reflector = (class_exists($type)) ? new \ReflectionClass($type) : null;
89
-        if(null !== $reflector && $reflector->isSubclassOf(Dto::class)) {
90
-            if(null !== $value && is_array($value)) {
91
-                if(!array_key_exists($type, $this->__cache)) {
89
+        if (null !== $reflector && $reflector->isSubclassOf(Dto::class)) {
90
+            if (null !== $value && is_array($value)) {
91
+                if (!array_key_exists($type, $this->__cache)) {
92 92
                     $this->__cache[$type] = new $type(false);
93 93
                 }
94
-                if($isArray) {
94
+                if ($isArray) {
95 95
                     $this->$key = [];
96
-                    foreach($value as $data) {
97
-                        if(null !== $data && is_array($data)) {
96
+                    foreach ($value as $data) {
97
+                        if (null !== $data && is_array($data)) {
98 98
                             $dto = clone $this->__cache[$type];
99 99
                             $dto->fromArray($data);
100 100
                             array_push($this->$key, $dto);
101 101
                         }
102 102
                     }
103
-                } else {
103
+                }else {
104 104
                     $this->$key = clone $this->__cache[$type];
105 105
                     $this->$key->fromArray($value);
106 106
                 }
107 107
             }
108
-        } else {
108
+        }else {
109 109
             $this->castValue($key, $value, $type);
110 110
         }
111 111
     }
Please login to merge, or discard this patch.
src/services/DocumentorService.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
                     if ($module === $requestModule && !preg_match('/^ROOT/i', $module)) {
63 63
                         $modules = [
64 64
                             'name' => $module,
65
-                            'path' => realpath(dirname($info['base'] . DIRECTORY_SEPARATOR . '..')),
65
+                            'path' => realpath(dirname($info['base'].DIRECTORY_SEPARATOR.'..')),
66 66
                         ];
67 67
                     }
68
-                } catch (Exception $e) {
68
+                }catch (Exception $e) {
69 69
                     $modules[] = $e->getMessage();
70 70
                 }
71 71
             }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function extractApiEndpoints(array $module)
85 85
     {
86
-        $modulePath = $module['path'] . DIRECTORY_SEPARATOR . 'Api';
86
+        $modulePath = $module['path'].DIRECTORY_SEPARATOR.'Api';
87 87
         $moduleName = $module['name'];
88 88
         $endpoints = [];
89 89
         if (file_exists($modulePath)) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 /** @var SplFileInfo $file */
94 94
                 foreach ($finder as $file) {
95 95
                     $filename = str_replace([$modulePath, '/'], ['', '\\'], $file->getPathname());
96
-                    $namespace = "\\{$moduleName}\\Api" . str_replace('.php', '', $filename);
96
+                    $namespace = "\\{$moduleName}\\Api".str_replace('.php', '', $filename);
97 97
                     $info = $this->extractApiInfo($namespace, $moduleName);
98 98
                     if (!empty($info)) {
99 99
                         $endpoints[$namespace] = $info;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                         if (NULL !== $mInfo) {
124 124
                             $info[] = $mInfo;
125 125
                         }
126
-                    } catch (Exception $e) {
126
+                    }catch (Exception $e) {
127 127
                         Logger::log($e->getMessage(), LOG_ERR);
128 128
                     }
129 129
                 }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             $payload = $this->extractModelFields($namespace);
242 242
             $reflector = new ReflectionClass($namespace);
243 243
             $shortName = $reflector->getShortName();
244
-        } else {
244
+        }else {
245 245
             $namespace = $model;
246 246
             $shortName = $model;
247 247
         }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
             } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) {
342 342
                 $payload = $this->extractDtoProperties($namespace);
343 343
             }
344
-        } catch (Exception $e) {
344
+        }catch (Exception $e) {
345 345
             Logger::log($e->getMessage(), LOG_ERR);
346 346
         }
347 347
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
                     $return = $this->extractReturn($modelNamespace, $docComments);
373 373
                     $url = array_pop($route);
374 374
                     $methodInfo = [
375
-                        'url' => str_replace('/' . $module . '/api', '', $url),
375
+                        'url' => str_replace('/'.$module.'/api', '', $url),
376 376
                         'method' => $info['http'],
377 377
                         'description' => $info['label'],
378 378
                         'return' => $return,
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
                     $this->setRequestParams($method, $methodInfo, $modelNamespace, $docComments);
384 384
                     $this->setQueryParams($method, $methodInfo);
385 385
                     $this->setRequestHeaders($reflection, $methodInfo);
386
-                } catch (Exception $e) {
386
+                }catch (Exception $e) {
387 387
                     Logger::log($e->getMessage(), LOG_ERR);
388 388
                 }
389 389
             }
@@ -455,10 +455,10 @@  discard block
 block discarded – undo
455 455
         $formatted = [
456 456
             "swagger" => "2.0",
457 457
             "host" => preg_replace('/^(http|https)\:\/\/(.*)\/$/i', '$2', Router::getInstance()->getRoute('', true)),
458
-            "basePath" => '/' . $module['name'] . '/api',
458
+            "basePath" => '/'.$module['name'].'/api',
459 459
             "schemes" => [Request::getInstance()->getServer('HTTPS') === 'on' ? 'https' : 'http'],
460 460
             "info" => [
461
-                "title" => t('Documentación API módulo ') . $module['name'],
461
+                "title" => t('Documentación API módulo ').$module['name'],
462 462
                 "version" => Config::getParam('api.version', '1.0.0'),
463 463
                 "contact" => [
464 464
                     "name" => Config::getParam("author", "Fran López"),
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
         foreach ($endpoints as $model) {
472 472
             foreach ($model as $endpoint) {
473 473
                 if (!preg_match('/^\/(admin|api)\//i', $endpoint['url']) && strlen($endpoint['url'])) {
474
-                    $url = preg_replace('/\/' . $module['name'] . '\/api/i', '', $endpoint['url']);
474
+                    $url = preg_replace('/\/'.$module['name'].'\/api/i', '', $endpoint['url']);
475 475
                     $description = $endpoint['description'];
476 476
                     $method = strtolower($endpoint['method']);
477 477
                     $paths[$url][$method] = [
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
             }
513 513
         }
514 514
         ksort($dtos);
515
-        uasort($paths, function ($path1, $path2) {
515
+        uasort($paths, function($path1, $path2) {
516 516
             $key1 = array_keys($path1)[0];
517 517
             $key2 = array_keys($path2)[0];
518 518
             return strcmp($path1[$key1]['tags'][0], $path2[$key2]['tags'][0]);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
     protected function extractDtoName($dto, $isArray = false)
533 533
     {
534 534
         $dto = explode('\\', $dto);
535
-        $modelDto = array_pop($dto) . "Dto";
535
+        $modelDto = array_pop($dto)."Dto";
536 536
         if ($isArray) {
537 537
             $modelDto .= "List";
538 538
         }
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
             foreach ($method->getParameters() as $parameter) {
632 632
                 $parameterName = $parameter->getName();
633 633
                 $types = [];
634
-                preg_match_all('/\@param\ (.*)\ \$' . $parameterName . '$/im', $docComments, $types);
634
+                preg_match_all('/\@param\ (.*)\ \$'.$parameterName.'$/im', $docComments, $types);
635 635
                 if (count($types) > 1 && count($types[1]) > 0) {
636 636
                     $methodInfo['parameters'][$parameterName] = $types[1][0];
637 637
                 }
@@ -653,13 +653,13 @@  discard block
 block discarded – undo
653 653
                     $modelDto['objects'][$dtoName][$param] = [
654 654
                         'type' => 'array',
655 655
                         'items' => [
656
-                            '$ref' => '#/definitions/' . $info['type'],
656
+                            '$ref' => '#/definitions/'.$info['type'],
657 657
                         ]
658 658
                     ];
659
-                } else {
659
+                }else {
660 660
                     $modelDto['objects'][$dtoName][$param] = [
661 661
                         'type' => 'object',
662
-                        '$ref' => '#/definitions/' . $info['type'],
662
+                        '$ref' => '#/definitions/'.$info['type'],
663 663
                     ];
664 664
                 }
665 665
                 $modelDto['objects'][$info['class']] = $info['properties'];
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
                 if (array_key_exists('objects', $paramDto)) {
668 668
                     $modelDto['objects'] = array_merge($modelDto['objects'], $paramDto['objects']);
669 669
                 }
670
-            } else {
670
+            }else {
671 671
                 $modelDto['objects'][$dtoName][$param] = $info;
672 672
             }
673 673
         }
Please login to merge, or discard this patch.
src/controller/RouteController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
             $router->simpatize();
58 58
             Security::getInstance()->setFlash("callback_message", t("Rutas generadas correctamente"));
59 59
             Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true));
60
-        } catch (Exception $e) {
60
+        }catch (Exception $e) {
61 61
             Logger::log($e->getMessage(), LOG_ERR);
62 62
             Security::getInstance()->setFlash("callback_message", t("Algo no ha salido bien, revisa los logs"));
63 63
             Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-routes", true));
Please login to merge, or discard this patch.