Passed
Push — master ( caa7b5...0cbc1d )
by Fran
02:26
created
src/base/types/traits/CurlTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
     protected $isMultipart = false;
78 78
 
79 79
     protected function closeConnection() {
80
-        if(null !== $this?->con) {
81
-            if($this?->con instanceof \CurlHandle) {
80
+        if (null !== $this?->con) {
81
+            if ($this?->con instanceof \CurlHandle) {
82 82
                 curl_close($this->con);
83 83
             }
84 84
             $this->setCon(null);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $this->params = [];
96 96
         $this->headers = [];
97
-        Logger::log('Context service for ' . static::class . ' cleared!');
97
+        Logger::log('Context service for '.static::class.' cleared!');
98 98
         $this->closeConnection();
99 99
     }
100 100
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $this->clearContext();
104 104
         $con = curl_init($this->url);
105
-        if($con instanceof \CurlHandle) {
105
+        if ($con instanceof \CurlHandle) {
106 106
             $this->setCon($con);
107 107
         }
108 108
     }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     public function setUrl(string $url, bool $cleanContext = true)
123 123
     {
124 124
         $this->url = $url;
125
-        if($cleanContext) {
125
+        if ($cleanContext) {
126 126
             $this->initialize();
127 127
         }
128 128
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function setIsJson($isJson = true) {
189 189
         $this->isJson = $isJson;
190
-        if($isJson) {
190
+        if ($isJson) {
191 191
             $this->setIsMultipart(false);
192 192
         }
193 193
     }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function setIsMultipart($isMultipart = true) {
206 206
         $this->isMultipart = $isMultipart;
207
-        if($isMultipart) {
207
+        if ($isMultipart) {
208 208
             $this->setIsJson(false);
209 209
         }
210 210
     }
Please login to merge, or discard this patch.
src/services/GeneratorService.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function createStructureModule($module, $force = false, $type = "", $apiClass = "")
41 41
     {
42
-        $modPath = CORE_DIR . DIRECTORY_SEPARATOR;
42
+        $modPath = CORE_DIR.DIRECTORY_SEPARATOR;
43 43
         $module = ucfirst($module);
44 44
         $this->createModulePath($module, $modPath);
45 45
         $this->createModulePathTree($module, $modPath);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     private function createModuleBaseFiles($module, $modPath, $force = false, $controllerType = '')
62 62
     {
63
-        $modulePath = $modPath . $module;
63
+        $modulePath = $modPath.$module;
64 64
         $this->generateControllerTemplate($module, $modulePath, $force, $controllerType);
65 65
         $this->generateServiceTemplate($module, $modulePath, $force);
66 66
         $this->generateSchemaTemplate($module, $modulePath, $force);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $this->genereateAutoloaderTemplate($module, $modulePath, $force);
81 81
         $this->generatePropertiesTemplate($module, $modulePath, $force);
82 82
         $this->generateConfigTemplate($modulePath, $force);
83
-        $this->createModuleModels($module, CORE_DIR . DIRECTORY_SEPARATOR);
83
+        $this->createModuleModels($module, CORE_DIR.DIRECTORY_SEPARATOR);
84 84
     }
85 85
 
86 86
     /**
@@ -100,28 +100,28 @@  discard block
 block discarded – undo
100 100
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
101 101
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
102 102
             "class" => $class,
103
-            "controllerType" => $class . "Base",
103
+            "controllerType" => $class."Base",
104 104
             "is_base" => false
105 105
         ));
106
-        $controller = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" .
107
-            DIRECTORY_SEPARATOR . "{$class}Controller.php", $force);
106
+        $controller = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller".
107
+            DIRECTORY_SEPARATOR."{$class}Controller.php", $force);
108 108
 
109 109
         $controllerBody = $this->tpl->dump("generator/controller.template.twig", array(
110 110
             "module" => $module,
111 111
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
112 112
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
113
-            "class" => $class . "Base",
113
+            "class" => $class."Base",
114 114
             "service" => $class,
115 115
             "controllerType" => $controllerType,
116 116
             "is_base" => true,
117 117
             "domain" => $class,
118 118
         ));
119
-        $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" .
120
-            DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true);
119
+        $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller".
120
+            DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true);
121 121
 
122
-        $filename = $modPath . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php";
122
+        $filename = $modPath.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php";
123 123
         $test = true;
124
-        if(!file_exists($filename)) {
124
+        if (!file_exists($filename)) {
125 125
             $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array(
126 126
                 "module" => $module,
127 127
                 "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
      */
141 141
     private function createModuleModels($module, $path)
142 142
     {
143
-        $modulePath = $path . $module;
144
-        $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $modulePath);
143
+        $modulePath = $path.$module;
144
+        $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $modulePath);
145 145
 
146 146
         $configGenerator = $this->getConfigGenerator($modulePath);
147 147
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
         $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array(
152 152
             "module" => $module,
153 153
         ));
154
-        $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . "Config" .
155
-            DIRECTORY_SEPARATOR . "config.php", true);
154
+        $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$modulePath.DIRECTORY_SEPARATOR."Config".
155
+            DIRECTORY_SEPARATOR."config.php", true);
156 156
         Logger::log("Generado config genérico para propel");
157 157
     }
158 158
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
     private function generateBaseApiTemplate($module, $modPath, $force = false, $apiClass = "")
168 168
     {
169 169
         $created = true;
170
-        $modelPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Models';
171
-        $apiPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Api';
170
+        $modelPath = $modPath.$module.DIRECTORY_SEPARATOR.'Models';
171
+        $apiPath = $modPath.$module.DIRECTORY_SEPARATOR.'Api';
172 172
         if (file_exists($modelPath)) {
173 173
             $dir = dir($modelPath);
174 174
             $this->generateApiFiles($module, $force, $apiClass, $dir, $apiPath);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         //Generamos el fichero de configuración
187 187
         Logger::log("Generamos fichero vacío de configuración");
188 188
         return $this->writeTemplateToFile("<?php\n\t",
189
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php",
189
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php",
190 190
             $force);
191 191
     }
192 192
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             "db" => $this->config->get("db_name"),
208 208
         ));
209 209
         return $this->writeTemplateToFile($schema,
210
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml",
210
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml",
211 211
             $force);
212 212
     }
213 213
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             "namespace" => preg_replace('/(\\\|\/)/', '', $module),
226 226
         ));
227 227
         return $this->writeTemplateToFile($buildProperties,
228
-            $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.php",
228
+            $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.php",
229 229
             $force);
230 230
     }
231 231
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             "module" => $module,
244 244
         ));
245 245
         return $this->writeTemplateToFile($index,
246
-            $modPath . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig",
246
+            $modPath.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig",
247 247
             $force);
248 248
     }
249 249
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         ));
274 274
 
275 275
         return $this->writeTemplateToFile($controller,
276
-            $modPath . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
276
+            $modPath.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
277 277
     }
278 278
 
279 279
     /**
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             "package" => $package,
299 299
         ));
300 300
 
301
-        return $this->writeTemplateToFile($controller, $modPath . DIRECTORY_SEPARATOR . "{$api}.php", $force);
301
+        return $this->writeTemplateToFile($controller, $modPath.DIRECTORY_SEPARATOR."{$api}.php", $force);
302 302
     }
303 303
 
304 304
     /**
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
         $base = $dir->path;
316 316
         while ($file = $dir->read()) {
317 317
             if (!in_array(strtolower($file), ['.', '..', 'base', 'map'])) {
318
-                if (is_dir($base . DIRECTORY_SEPARATOR . $file)) {
319
-                    $this->generateApiFiles($module, $force, $apiClass, dir($base . DIRECTORY_SEPARATOR . $file), $apiPath . DIRECTORY_SEPARATOR . $file, $file);
320
-                } else if (!preg_match('/Query\.php$/i', $file)
318
+                if (is_dir($base.DIRECTORY_SEPARATOR.$file)) {
319
+                    $this->generateApiFiles($module, $force, $apiClass, dir($base.DIRECTORY_SEPARATOR.$file), $apiPath.DIRECTORY_SEPARATOR.$file, $file);
320
+                }else if (!preg_match('/Query\.php$/i', $file)
321 321
                     && !preg_match('/I18n\.php$/i', $file)
322 322
                     && preg_match('/\.php$/i', $file)
323 323
                 ) {
324 324
                     $filename = str_replace(".php", "", $file);
325 325
                     $this->log->addLog("Generamos Api BASES para {$filename}");
326
-                    if($this->checkIfIsModel($module, $filename, $package)) {
326
+                    if ($this->checkIfIsModel($module, $filename, $package)) {
327 327
                         $this->createApiBaseFile($module, $apiPath, $filename, $apiClass, $package);
328 328
                         $this->createApi($module, $apiPath, $force, $filename, $package);
329 329
                     }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             $parts[] = $package;
347 347
         }
348 348
         $parts[] = $filename;
349
-        $namespace = '\\' . implode('\\', $parts);
349
+        $namespace = '\\'.implode('\\', $parts);
350 350
         $reflectorClass = new \ReflectionClass($namespace);
351 351
         $isModel = $reflectorClass->isInstantiable();
352 352
         return $isModel;
Please login to merge, or discard this patch.
src/autoload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     // autoloader
15 15
     function PSFSAutoloader($class)
16 16
     {
17
-        Logger::log("Trying to load class {$class} with " . __FILE__);
17
+        Logger::log("Trying to load class {$class} with ".__FILE__);
18 18
         // it only autoload class into the Rain scope
19 19
         if (str_contains($class, 'PSFS')) {
20 20
             // Change order src
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
             $path = str_replace("\\", DIRECTORY_SEPARATOR, $class);
24 24
 
25 25
             // filepath
26
-            $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php";
26
+            $abs_path = SOURCE_DIR.DIRECTORY_SEPARATOR.$path.".php";
27 27
 
28 28
             // require the file
29 29
             if (file_exists($abs_path)) {
30 30
                 require_once $abs_path;
31
-            } else {
32
-                Logger::log("{$class} not loaded with " . __FILE__);
31
+            }else {
32
+                Logger::log("{$class} not loaded with ".__FILE__);
33 33
             }
34 34
         }
35 35
         return false;
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
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         $now = new \DateTime();
19 19
         $now->setTimezone(new \DateTimeZone(Config::getParam('project.timezone', 'Europe/Madrid')));
20 20
         $config = Config::getInstance()->dumpConfig();
21
-        $config[self::CACHE_VAR_TAG] = 'v' . $now->format('Ymd.His');
21
+        $config[self::CACHE_VAR_TAG] = 'v'.$now->format('Ymd.His');
22 22
         Config::save($config);
23 23
         return $config[self::CACHE_VAR_TAG];
24 24
     }
Please login to merge, or discard this patch.
src/base/dto/Dto.php 1 patch
Spacing   +19 added lines, -19 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
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     /**
133 133
      * @return mixed
134 134
      */
135
-    public function jsonSerialize(): array|string|null
135
+    public function jsonSerialize(): array | string | null
136 136
     {
137 137
         return $this->toArray();
138 138
     }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @return mixed
173 173
      */
174 174
     protected function checkCastedValue($rawValue, $type) {
175
-        if(null !== $rawValue) {
175
+        if (null !== $rawValue) {
176 176
             switch ($type) {
177 177
                 default:
178 178
                 case 'string':
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                     $value = (bool)$rawValue;
192 192
                     break;
193 193
             }
194
-        } else {
194
+        }else {
195 195
             $value = $rawValue;
196 196
         }
197 197
         return $value;
Please login to merge, or discard this patch.
src/base/types/Api.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -56,20 +56,20 @@  discard block
 block discarded – undo
56 56
     public function init()
57 57
     {
58 58
         parent::init();
59
-        Logger::log(static::class . ' init', LOG_DEBUG);
59
+        Logger::log(static::class.' init', LOG_DEBUG);
60 60
         $this->domain = $this->getDomain();
61 61
         $this->hydrateRequestData();
62 62
         $this->hydrateOrders();
63
-        if($this instanceof CustomApi === false) {
63
+        if ($this instanceof CustomApi === false) {
64 64
             $this->createConnection($this->getTableMap());
65 65
         }
66 66
         $this->checkFieldType();
67 67
         $this->setLoaded(true);
68
-        Logger::log(static::class . ' loaded', LOG_DEBUG);
68
+        Logger::log(static::class.' loaded', LOG_DEBUG);
69 69
     }
70 70
 
71 71
     private function checkActions($method) {
72
-        switch($method) {
72
+        switch ($method) {
73 73
             default:
74 74
             case 'modelList': $this->action = self::API_ACTION_LIST; break;
75 75
             case 'get': $this->action = self::API_ACTION_GET; break;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $code = 200;
95 95
         list($return, $total, $pages) = $this->getList();
96 96
         $message = null;
97
-        if(!$total) {
97
+        if (!$total) {
98 98
             $message = t('No se han encontrado elementos para la búsqueda');
99 99
         }
100 100
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         $pages = 1;
120 120
         $message = null;
121 121
         list($code, $return) = $this->getSingleResult($pk);
122
-        if($code !== 200) {
122
+        if ($code !== 200) {
123 123
             $message = t('No se ha encontrado el elemento solicitado');
124 124
         }
125 125
 
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
                 $status = 200;
149 149
                 $saved = TRUE;
150 150
                 $model = $this->model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
151
-            } else {
151
+            }else {
152 152
                 $message = t('No se ha podido guardar el modelo seleccionado');
153 153
             }
154
-        } catch (\Exception $e) {
155
-            $message = t('Ha ocurrido un error intentando guardar el elemento: ') .'<br>'. $e->getMessage();
154
+        }catch (\Exception $e) {
155
+            $message = t('Ha ocurrido un error intentando guardar el elemento: ').'<br>'.$e->getMessage();
156 156
             $context = [];
157
-            if(null !== $e->getPrevious()) {
157
+            if (null !== $e->getPrevious()) {
158 158
                 $context[] = $e->getPrevious()->getMessage();
159 159
             }
160 160
             Logger::log($e->getMessage(), LOG_CRIT, $context);
@@ -190,18 +190,18 @@  discard block
 block discarded – undo
190 190
                     $updated = TRUE;
191 191
                     $status = 200;
192 192
                     $model = $this->model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
193
-                } else {
193
+                }else {
194 194
                     $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
195 195
                 }
196
-            } catch (\Exception $e) {
196
+            }catch (\Exception $e) {
197 197
                 $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
198 198
                 $context = [];
199
-                if(null !== $e->getPrevious()) {
199
+                if (null !== $e->getPrevious()) {
200 200
                     $context[] = $e->getPrevious()->getMessage();
201 201
                 }
202 202
                 Logger::log($e->getMessage(), LOG_CRIT, $context);
203 203
             }
204
-        } else {
204
+        }else {
205 205
             $message = t('No se ha encontrado el modelo al que se hace referencia para actualizar');
206 206
         }
207 207
 
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
                 $this->con->beginTransaction();
230 230
                 $this->hydrateModel($pk);
231 231
                 if (NULL !== $this->model) {
232
-                    if(method_exists('clearAllReferences', $this->model)) {
232
+                    if (method_exists('clearAllReferences', $this->model)) {
233 233
                         $this->model->clearAllReferences(true);
234 234
                     }
235 235
                     $this->model->delete($this->con);
236 236
                     $deleted = TRUE;
237 237
                 }
238
-            } catch (\Exception $e) {
238
+            }catch (\Exception $e) {
239 239
                 $context = [];
240
-                if(null !== $e->getPrevious()) {
240
+                if (null !== $e->getPrevious()) {
241 241
                     $context[] = $e->getPrevious()->getMessage();
242 242
                 }
243 243
                 Logger::log($e->getMessage(), LOG_CRIT, $context);
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             $this->saveBulk();
267 267
             $saved = true;
268 268
             $status = 200;
269
-        } catch(\Exception $e) {
269
+        }catch (\Exception $e) {
270 270
             Logger::log($e->getMessage(), LOG_CRIT, $this->getRequest()->getData());
271 271
             $message = t('Bulk insert rolled back');
272 272
         }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
         /** @var CustomerTableMap $tableMap */
280 280
         $modelPk = ApiHelper::extractPrimaryKeyColumnName($this->getTableMap());
281
-        foreach($this->list->getData() as $data) {
281
+        foreach ($this->list->getData() as $data) {
282 282
             $return[] = ApiHelper::mapArrayObject($this->getModelNamespace(), $modelPk, $this->query, $data);
283 283
         }
284 284
         return $return;
@@ -295,23 +295,23 @@  discard block
 block discarded – undo
295 295
         try {
296 296
             $this->paginate();
297 297
             if (null !== $this->list) {
298
-                if(array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
298
+                if (array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
299 299
                     $return = $this->extractDataWithFormat();
300
-                } else {
300
+                }else {
301 301
                     $return = $this->list->toArray(null, false, $this->fieldType ?: TableMap::TYPE_PHPNAME, false);
302 302
                 }
303 303
                 $total = 0;
304 304
                 $pages = 0;
305
-                if($this->list instanceof PropelModelPager) {
305
+                if ($this->list instanceof PropelModelPager) {
306 306
                     $total = $this->list->getNbResults();
307 307
                     $pages = $this->list->getLastPage();
308
-                } elseif($this->list instanceof ArrayCollection) {
308
+                } elseif ($this->list instanceof ArrayCollection) {
309 309
                     $total = count($return);
310 310
                     $pages = 1;
311 311
                 }
312 312
             }
313
-        } catch (\Exception $e) {
314
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
313
+        }catch (\Exception $e) {
314
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
315 315
         }
316 316
 
317 317
         return array($return, $total, $pages);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         $return = array();
330 330
         if (NULL === $model || !method_exists($model, 'toArray')) {
331 331
             $code = 404;
332
-        } else {
332
+        }else {
333 333
             $return = $model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true);
334 334
         }
335 335
 
Please login to merge, or discard this patch.
src/base/types/traits/Api/Crud/ApiListTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     protected function hydrateOrders()
38 38
     {
39 39
         if (count($this->query)) {
40
-            Logger::log(static::class . ' gathering query string', LOG_DEBUG);
40
+            Logger::log(static::class.' gathering query string', LOG_DEBUG);
41 41
             foreach ($this->query as $key => $value) {
42 42
                 if ($key === self::API_ORDER_FIELD) {
43 43
                     $orders = json_decode($value, true);
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
      */
56 56
     protected function extractPagination()
57 57
     {
58
-        Logger::log(static::class . ' extract pagination start', LOG_DEBUG);
58
+        Logger::log(static::class.' extract pagination start', LOG_DEBUG);
59 59
         $page = array_key_exists(self::API_PAGE_FIELD, $this->query) ? $this->query[self::API_PAGE_FIELD] : 1;
60 60
         $limit = array_key_exists(self::API_LIMIT_FIELD, $this->query) ? $this->query[self::API_LIMIT_FIELD] : 100;
61
-        Logger::log(static::class . ' extract pagination end', LOG_DEBUG);
61
+        Logger::log(static::class.' extract pagination end', LOG_DEBUG);
62 62
         return array($page, (int)$limit);
63 63
     }
64 64
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      * @param ModelCriteria $query
68 68
      * @throws \PSFS\base\exception\ApiException
69 69
      */
70
-    protected function addOrders(ModelCriteria &$query)
70
+    protected function addOrders(ModelCriteria & $query)
71 71
     {
72
-        Logger::log(static::class . ' extract orders start ', LOG_DEBUG);
72
+        Logger::log(static::class.' extract orders start ', LOG_DEBUG);
73 73
         $orderAdded = FALSE;
74 74
         $tableMap = $this->getTableMap();
75 75
         foreach ($this->order->getOrders() as $field => $direction) {
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
                 $orderAdded = TRUE;
78 78
                 if ($direction === Order::ASC) {
79 79
                     $query->addAscendingOrderByColumn($column->getPhpName());
80
-                } else {
80
+                }else {
81 81
                     $query->addDescendingOrderByColumn($column->getPhpName());
82 82
                 }
83 83
             }
84 84
         }
85 85
         if (!$orderAdded) {
86 86
             $pks = $this->getPkDbName();
87
-            foreach(array_keys($pks) as $key) {
87
+            foreach (array_keys($pks) as $key) {
88 88
                 $query->addAscendingOrderByColumn($key);
89 89
             }
90 90
         }
91
-        Logger::log(static::class . ' extract orders end', LOG_DEBUG);
91
+        Logger::log(static::class.' extract orders end', LOG_DEBUG);
92 92
     }
93 93
 
94 94
     /**
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @param ModelCriteria $query
98 98
      */
99
-    protected function addFilters(ModelCriteria &$query)
99
+    protected function addFilters(ModelCriteria & $query)
100 100
     {
101 101
         if (count($this->query) > 0) {
102 102
             $tableMap = $this->getTableMap();
103 103
             foreach ($this->query as $field => $value) {
104 104
                 if (self::API_COMBO_FIELD === $field) {
105 105
                     ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value);
106
-                } elseif(!preg_match('/^__/', $field)) {
106
+                } elseif (!preg_match('/^__/', $field)) {
107 107
                     ApiHelper::addModelField($tableMap, $query, $field, $value);
108 108
                 }
109 109
             }
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
             list($page, $limit) = $this->extractPagination();
124 124
             if ($limit === -1) {
125 125
                 $this->list = $query->find($this->con);
126
-            } else {
126
+            }else {
127 127
                 $this->list = $query->paginate($page, $limit, $this->con);
128 128
             }
129 129
             $this->checkReturnFields($this->list->getQuery());
130
-        } catch (\Exception $e) {
130
+        }catch (\Exception $e) {
131 131
             Logger::log($e->getMessage(), LOG_ERR);
132 132
         }
133 133
     }
Please login to merge, or discard this patch.