Test Failed
Push — master ( 1cd2da...3b4d09 )
by Fran
02:52
created
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/traits/Api/ManagerTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
             "domain" => $this->getDomain(),
40 40
             "listLabel" => Api::API_LIST_NAME_FIELD,
41 41
             'modelId' => Api::API_MODEL_KEY_FIELD,
42
-            'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-' . $this->getDomain() . '-' . $this->getApi()), TRUE)),
43
-            "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain() . '-' . 'api-' . $this->getApi() . "-pk"), TRUE)),
42
+            'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-'.$this->getDomain().'-'.$this->getApi()), TRUE)),
43
+            "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain().'-'.'api-'.$this->getApi()."-pk"), TRUE)),
44 44
         ), [], '');
45 45
     }
46 46
 
Please login to merge, or discard this patch.
src/base/types/Form.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@
 block discarded – undo
65 65
             $model = $this->getHydratedModel();
66 66
             $model->save();
67 67
             $save = true;
68
-            Logger::log(get_class($this->model) . ' guardado con id ' . $this->model->getPrimaryKey(), LOG_INFO);
69
-        } catch (\Exception $e) {
68
+            Logger::log(get_class($this->model).' guardado con id '.$this->model->getPrimaryKey(), LOG_INFO);
69
+        }catch (\Exception $e) {
70 70
             Logger::log($e->getMessage(), LOG_ERR);
71 71
             throw new FormException($e->getMessage(), $e->getCode(), $e);
72 72
         }
Please login to merge, or discard this patch.
src/base/types/traits/Form/FormValidatorTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
         if (null === $value) {
48 48
             $isEmpty = true;
49 49
             // Empty Array check
50
-        } else if (is_array($value) && 0 === count($value)) {
50
+        }else if (is_array($value) && 0 === count($value)) {
51 51
             $isEmpty = true;
52 52
             // Empty string check
53
-        } else if ('' === preg_replace('/(\ |\r|\n)/m', '', $value)) {
53
+        }else if ('' === preg_replace('/(\ |\r|\n)/m', '', $value)) {
54 54
             $isEmpty = true;
55 55
         }
56 56
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             && array_key_exists($key, $field)
77 77
             && !array_key_exists('error', $field[$key])
78 78
             && !empty($field['value'])
79
-            && preg_match('/' . $field['pattern'] . '/', $field['value']) === 0
79
+            && preg_match('/'.$field['pattern'].'/', $field['value']) === 0
80 80
         ) {
81 81
             $this->setError($key, str_replace('%s', "<strong>{$key}</strong>", t('El campo %s no tiene un formato válido')));
82 82
             $field['error'] = $this->getError($key);
Please login to merge, or discard this patch.
src/base/types/traits/Form/FormModelTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      */
48 48
     private function hydrateModelField($key, $value)
49 49
     {
50
-        $setter = 'set' . ucfirst($key);
51
-        $getter = 'get' . ucfirst($key);
50
+        $setter = 'set'.ucfirst($key);
51
+        $getter = 'get'.ucfirst($key);
52 52
         if (method_exists($this->model, $setter)) {
53 53
             if (method_exists($this->model, $getter)) {
54 54
                 $tmp = $this->model->$getter();
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     {
73 73
         //Extraemos el dato del modelo relacionado si existe el getter
74 74
         $method = null;
75
-        if (array_key_exists('class_data', $field) && method_exists($val, 'get' . $field['class_data'])) {
76
-            $classMethod = 'get' . $field['class_data'];
75
+        if (array_key_exists('class_data', $field) && method_exists($val, 'get'.$field['class_data'])) {
76
+            $classMethod = 'get'.$field['class_data'];
77 77
             $class = $val->$classMethod();
78
-            if (array_key_exists('class_id', $field) && method_exists($class, 'get' . $field['class_id'])) {
79
-                $method = 'get' . $field['class_id'];
78
+            if (array_key_exists('class_id', $field) && method_exists($class, 'get'.$field['class_id'])) {
79
+                $method = 'get'.$field['class_id'];
80 80
                 $data[] = $class->$method();
81
-            } else {
81
+            }else {
82 82
                 $data[] = $class->getPrimaryKey();
83 83
             }
84
-        } else {
84
+        }else {
85 85
             $data[] = $val;
86 86
         }
87 87
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     private function extractModelFieldValue($key, $field)
134 134
     {
135 135
         //Extraemos el valor del campo del modelo
136
-        $method = 'get' . ucfirst($key);
136
+        $method = 'get'.ucfirst($key);
137 137
         $type = (array_key_exists('type', $field)) ? $field['type'] : 'text';
138 138
         //Extraemos los campos del modelo
139 139
         if (method_exists($this->model, $method)) {
@@ -143,16 +143,16 @@  discard block
 block discarded – undo
143 143
                 //Si es una relación múltiple
144 144
                 if ($value instanceof ObjectCollection) {
145 145
                     $field = $this->computeModelFieldValue($field, $value, $type);
146
-                } else { //O una relación unitaria
146
+                }else { //O una relación unitaria
147 147
                     if (method_exists($value, '__toString')) {
148 148
                         $field['value'] = $value;
149 149
                     } elseif ($value instanceof \DateTime) {
150 150
                         $field['value'] = $value->format('Y-m-d H:i:s');
151
-                    } else {
151
+                    }else {
152 152
                         $field['value'] = $value->getPrimaryKey();
153 153
                     }
154 154
                 }
155
-            } else {
155
+            }else {
156 156
                 $field['value'] = $value;
157 157
             }
158 158
         }
Please login to merge, or discard this patch.
src/base/types/traits/Form/FormSecurityTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         }
30 30
         if ('' !== $hashOrig) {
31 31
             $this->crfs = sha1($hashOrig);
32
-            $this->add($this->getName() . '_token', array(
32
+            $this->add($this->getName().'_token', array(
33 33
                 'type' => 'hidden',
34 34
                 'value' => $this->crfs,
35 35
             ));
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function isValid()
44 44
     {
45 45
         $valid = true;
46
-        $tokenField = $this->getName() . '_token';
46
+        $tokenField = $this->getName().'_token';
47 47
         // Check crfs token
48 48
         if (!$this->existsFormToken($tokenField)) {
49 49
             $this->errors[$tokenField] = t('Formulario no válido');
Please login to merge, or discard this patch.
src/base/extension/AssetsTokenParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
         $tmp = [];
142 142
         if (null === $node) {
143 143
             $node = $value;
144
-        } else {
144
+        }else {
145 145
             $tmp = $this->getTmpAttribute($node);
146 146
         }
147 147
         if (null !== $node) {
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.
src/base/Singleton.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function __construct()
28 28
     {
29
-        Logger::log(static::class . ' constructor invoked');
29
+        Logger::log(static::class.' constructor invoked');
30 30
         $this->init();
31 31
     }
32 32
 
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
         $calledClass = static::class;
86 86
         try {
87 87
             $instance = InjectorHelper::constructInjectableInstance($variable, $singleton, $classNameSpace, $calledClass);
88
-            $setter = 'set' . ucfirst($variable);
88
+            $setter = 'set'.ucfirst($variable);
89 89
             if (method_exists($calledClass, $setter)) {
90 90
                 $this->$setter($instance);
91
-            } else {
91
+            }else {
92 92
                 $this->$variable = $instance;
93 93
             }
94
-        } catch (Exception $e) {
95
-            Logger::log($e->getMessage() . ': ' . $e->getFile() . ' [' . $e->getLine() . ']', LOG_ERR);
94
+        }catch (Exception $e) {
95
+            Logger::log($e->getMessage().': '.$e->getFile().' ['.$e->getLine().']', LOG_ERR);
96 96
             throw $e;
97 97
         }
98 98
         return $this;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     {
108 108
         if (!$this->isLoaded()) {
109 109
             $filename = sha1(get_class($this));
110
-            $cacheFilename = 'reflections' . DIRECTORY_SEPARATOR . substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2) . DIRECTORY_SEPARATOR . $filename . '.json';
110
+            $cacheFilename = 'reflections'.DIRECTORY_SEPARATOR.substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2).DIRECTORY_SEPARATOR.$filename.'.json';
111 111
             /** @var Cache $cacheService */
112 112
             $cacheService = Cache::getInstance();
113 113
             /** @var Config $configService */
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
                 }
126 126
             }
127 127
             $this->setLoaded();
128
-        } else {
129
-            Logger::log(get_class($this) . ' already loaded', LOG_INFO);
128
+        }else {
129
+            Logger::log(get_class($this).' already loaded', LOG_INFO);
130 130
         }
131 131
     }
132 132
 }
Please login to merge, or discard this patch.