Passed
Push — master ( 8e9e8c...5c7da6 )
by Fran
03:59
created
src/base/types/traits/Helper/FieldHelperTrait.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
         $behaviors = $tableMap->getBehaviors();
123 123
         foreach ($map::getFieldNames() as $field) {
124 124
             $fDto = self::parseFormField($domain, $tableMap, $field, $behaviors);
125
-            if(null !== $fDto) {
125
+            if (null !== $fDto) {
126 126
                 $form->addField($fDto);
127 127
             }
128 128
         }
129 129
 
130
-        if(array_key_exists('i18n', $behaviors)) {
131
-            $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n');
132
-            if(null !== $relateI18n) {
130
+        if (array_key_exists('i18n', $behaviors)) {
131
+            $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n');
132
+            if (null !== $relateI18n) {
133 133
                 $i18NTableMap = $relateI18n->getLocalTable();
134
-                foreach($i18NTableMap->getColumns() as $columnMap) {
134
+                foreach ($i18NTableMap->getColumns() as $columnMap) {
135 135
                     $columnName = self::getColumnMapName($columnMap);
136
-                    if(!$form->fieldExists($columnName)) {
136
+                    if (!$form->fieldExists($columnName)) {
137 137
                         $fDto = self::parseFormField($domain, $i18NTableMap, $columnMap->getPhpName(), $i18NTableMap->getBehaviors());
138
-                        if(null !== $fDto) {
138
+                        if (null !== $fDto) {
139 139
                             $fDto->pk = false;
140 140
                             $fDto->required = true;
141 141
                             $form->addField($fDto);
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
     {
159 159
         $column = null;
160 160
         try {
161
-            foreach($tableMap->getColumns() as $tableMapColumn) {
161
+            foreach ($tableMap->getColumns() as $tableMapColumn) {
162 162
                 $columnName = $tableMapColumn->getPhpName();
163
-                if(preg_match('/^'.$field.'$/i', $columnName)) {
163
+                if (preg_match('/^'.$field.'$/i', $columnName)) {
164 164
                     $column = $tableMapColumn;
165 165
                     break;
166 166
                 }
167 167
             }
168
-        } catch (\Exception $e) {
168
+        }catch (\Exception $e) {
169 169
             Logger::log($e->getMessage(), LOG_DEBUG);
170 170
         }
171 171
         return $column;
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public static function getFieldTypes() {
178 178
         $configType = Config::getParam('api.field.case', TableMap::TYPE_PHPNAME);
179
-        switch($configType) {
179
+        switch ($configType) {
180 180
             default:
181 181
             case 'UpperCamelCase':
182 182
             case TableMap::TYPE_PHPNAME:
Please login to merge, or discard this patch.
src/base/types/helpers/ApiHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         } elseif ($mappedColumn->isText()) {
44 44
             if ($mappedColumn->getSize() > 100) {
45 45
                 $fDto = self::createField($field, Field::TEXTAREA_TYPE, $required);
46
-            } else {
46
+            }else {
47 47
                 $fDto = self::generateStringField($field, $required);
48 48
             }
49 49
         } elseif ($mappedColumn->getType() === PropelTypes::BOOLEAN) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         } elseif (in_array($mappedColumn->getType(), [PropelTypes::ENUM, PropelTypes::SET])) {
60 60
             $fDto = self::generateEnumField($field, $required);
61 61
             foreach ($mappedColumn->getValueSet() as $value) {
62
-                switch(Config::getParam('api.field.case', TableMap::TYPE_PHPNAME)) {
62
+                switch (Config::getParam('api.field.case', TableMap::TYPE_PHPNAME)) {
63 63
                     default:
64 64
                     case TableMap::TYPE_PHPNAME:
65 65
                         $fieldName = $mappedColumn->getPhpName();
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 $fDto->pk = true;
84 84
             }
85 85
         }
86
-        switch(Config::getParam('api.field.case', TableMap::TYPE_PHPNAME)) {
86
+        switch (Config::getParam('api.field.case', TableMap::TYPE_PHPNAME)) {
87 87
             default:
88 88
             case TableMap::TYPE_PHPNAME:
89 89
                 $fDto->name = $mappedColumn->getPhpName();
Please login to merge, or discard this patch.
src/base/dto/Form.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
             $array['fields'][] = $field->__toArray();
43 43
         }
44 44
         usort($array['fields'], function($fieldA, $fieldB) {
45
-            if((bool)$fieldA['required'] !== (bool)$fieldB['required']) {
46
-                if((bool)$fieldA['required']) {
45
+            if ((bool)$fieldA['required'] !== (bool)$fieldB['required']) {
46
+                if ((bool)$fieldA['required']) {
47 47
                     return -1;
48
-                } else {
48
+                }else {
49 49
                     return 1;
50 50
                 }
51 51
             }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             }
57 57
             return ($aOrder < $bOrder) ? -1 : 1;
58 58
         });
59
-        foreach($this->actions as $action) {
59
+        foreach ($this->actions as $action) {
60 60
             $array['actions'][] = $action->__toArray();
61 61
         }
62 62
         return $array;
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 = array())
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,22 +47,22 @@  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
                         $dto[$property->getName()] = $property->getValue($this);
61 61
                     }
62 62
                 }
63 63
             }
64
-        } catch (\Exception $e) {
65
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
64
+        }catch (\Exception $e) {
65
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
66 66
         }
67 67
         return $dto;
68 68
     }
@@ -85,26 +85,26 @@  discard block
 block discarded – undo
85 85
     protected function parseDtoField(array $properties, $key, $value = null) {
86 86
         list($type, $isArray) = $this->extractTypes($properties, $key);
87 87
         $reflector = (class_exists($type)) ? new \ReflectionClass($type) : null;
88
-        if(null !== $reflector && $reflector->isSubclassOf(Dto::class)) {
89
-            if(null !== $value && is_array($value)) {
90
-                if(!array_key_exists($type, $this->__cache)) {
88
+        if (null !== $reflector && $reflector->isSubclassOf(Dto::class)) {
89
+            if (null !== $value && is_array($value)) {
90
+                if (!array_key_exists($type, $this->__cache)) {
91 91
                     $this->__cache[$type] = new $type(false);
92 92
                 }
93
-                if($isArray) {
93
+                if ($isArray) {
94 94
                     $this->$key = [];
95
-                    foreach($value as $data) {
96
-                        if(null !== $data && is_array($data)) {
95
+                    foreach ($value as $data) {
96
+                        if (null !== $data && is_array($data)) {
97 97
                             $dto = clone $this->__cache[$type];
98 98
                             $dto->fromArray($data);
99 99
                             array_push($this->$key, $dto);
100 100
                         }
101 101
                     }
102
-                } else {
102
+                }else {
103 103
                     $this->$key = clone $this->__cache[$type];
104 104
                     $this->$key->fromArray($value);
105 105
                 }
106 106
             }
107
-        } else {
107
+        }else {
108 108
             $this->castValue($key, $value, $type);
109 109
         }
110 110
     }
Please login to merge, or discard this patch.
src/base/types/helpers/ServiceHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     }
16 16
 
17 17
     public static function parseRawData($type, $params) {
18
-        switch($type) {
18
+        switch ($type) {
19 19
             default:
20 20
             case self::TYPE_HTTP:
21 21
                 $parsedParams = http_build_query($params);
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/base/types/helpers/DeployHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     public static function updateCacheVar() {
18 18
         $now = new \DateTime(null, new \DateTimeZone(Config::getParam('project.timezone', 'Europe/Madrid')));
19 19
         $config = Config::getInstance()->dumpConfig();
20
-        $config[self::CACHE_VAR_TAG] = 'v' . $now->format('Ymd.His');
20
+        $config[self::CACHE_VAR_TAG] = 'v'.$now->format('Ymd.His');
21 21
         Config::save($config);
22 22
         return $config[self::CACHE_VAR_TAG];
23 23
     }
Please login to merge, or discard this patch.
src/controller/GeneratorController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function generateModule()
30 30
     {
31
-        Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri());
31
+        Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri());
32 32
         /* @var $form \PSFS\base\config\ConfigForm */
33 33
         $form = new ModuleForm();
34 34
         $form->build();
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
                 $this->gen->createStructureModule($module, false, $type, $apiClass);
61 61
                 Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, t("Módulo %s generado correctamente")));
62 62
                 // Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true));
63
-            } catch (\Exception $e) {
64
-                Logger::log($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
63
+            }catch (\Exception $e) {
64
+                Logger::log($e->getMessage()." [".$e->getFile().":".$e->getLine()."]");
65 65
                 Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage()));
66 66
             }
67 67
         }
Please login to merge, or discard this patch.