Passed
Push — master ( b37f55...96b935 )
by Fran
04:33
created
src/base/config/ModuleForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
             "Auth" => _("Requiere autenticación de usuario"),
35 35
             "AuthAdmin" => _("Requiere autenticación de administrador"),
36 36
         );
37
-        if(Config::getParam('psfs.auth')) {
37
+        if (Config::getParam('psfs.auth')) {
38 38
             $controllerTypes['SessionAuthApi'] = _('Requiere autenticación usando PSFS AUTH');
39 39
         }
40 40
         $this->add('module', array(
Please login to merge, or discard this patch.
src/base/types/helpers/AdminHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $routes = [];
33 33
         foreach ($systemRoutes as $route => $params) {
34
-            if(isset($params['http']) && 'GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) {
34
+            if (isset($params['http']) && 'GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) {
35 35
                 $module = strtoupper($params['module']);
36 36
                 $mode = $params["visible"] ? 'visible' : 'hidden';
37 37
                 $routes[$module][$mode][] = [
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
                 ];
42 42
             }
43 43
         }
44
-        foreach($routes as $module => &$route) {
45
-            if(array_key_exists('visible', $route)) {
44
+        foreach ($routes as $module => &$route) {
45
+            if (array_key_exists('visible', $route)) {
46 46
                 uasort($route["visible"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel');
47 47
             }
48
-            if(array_key_exists('hidden', $route)) {
48
+            if (array_key_exists('hidden', $route)) {
49 49
                 uasort($route["hidden"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel');
50 50
             }
51 51
         }
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
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function generateModule()
32 32
     {
33
-        Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri());
33
+        Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri());
34 34
         /* @var $form \PSFS\base\config\ConfigForm */
35 35
         $form = new ModuleForm();
36 36
         $form->build();
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
                 $this->gen->createStructureModule($module, false, $type, $apiClass);
62 62
                 Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente")));
63 63
                 Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true));
64
-            } catch (\Exception $e) {
65
-                Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
64
+            }catch (\Exception $e) {
65
+                Logger::getInstance()->infoLog($e->getMessage()." [".$e->getFile().":".$e->getLine()."]");
66 66
                 Security::getInstance()->setFlash("callback_message", $e->getMessage());
67 67
             }
68 68
         }
Please login to merge, or discard this patch.
src/base/types/helpers/GeneratorHelper.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
             $objects = scandir($dir);
20 20
             foreach ($objects as $object) {
21 21
                 if ($object != "." && $object != "..") {
22
-                    if (filetype($dir . "/" . $object) == "dir") {
23
-                        self::deleteDir($dir . "/" . $object);
24
-                    } else {
25
-                        unlink($dir . "/" . $object);
22
+                    if (filetype($dir."/".$object) == "dir") {
23
+                        self::deleteDir($dir."/".$object);
24
+                    }else {
25
+                        unlink($dir."/".$object);
26 26
                     }
27 27
                 }
28 28
             }
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $rootDirs = array("css", "js", "media", "font");
40 40
         foreach ($rootDirs as $dir) {
41
-            if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) {
41
+            if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) {
42 42
                 try {
43
-                    self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir);
44
-                } catch (\Exception $e) {
43
+                    self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir);
44
+                }catch (\Exception $e) {
45 45
                     Logger::log($e->getMessage());
46 46
                 }
47 47
             }
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
     {
58 58
         try {
59 59
             if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) {
60
-                throw new \Exception(_('Can\'t create directory ') . $dir);
60
+                throw new \Exception(_('Can\'t create directory ').$dir);
61 61
             }
62
-        } catch (\Exception $e) {
62
+        }catch (\Exception $e) {
63 63
             Logger::log($e->getMessage(), LOG_WARNING);
64 64
             if (!file_exists(dirname($dir))) {
65
-                throw new GeneratorException($e->getMessage() . $dir);
65
+                throw new GeneratorException($e->getMessage().$dir);
66 66
             }
67 67
         }
68 68
     }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public static function getTemplatePath()
75 75
     {
76
-        $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
76
+        $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR;
77 77
         return realpath($path);
78 78
     }
79 79
 
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
      * @throws GeneratorException
92 92
      */
93 93
     public static function checkCustomNamespaceApi($namespace) {
94
-        if(!empty($namespace)) {
95
-            if(class_exists($namespace)) {
94
+        if (!empty($namespace)) {
95
+            if (class_exists($namespace)) {
96 96
                 $reflector = new \ReflectionClass($namespace);
97
-                if(!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) {
97
+                if (!$reflector->isSubclassOf(\PSFS\base\types\Api::class)) {
98 98
                     throw new GeneratorException(_('La clase definida debe extender de PSFS\\\base\\\types\\\Api'), 501);
99
-                } elseif(!$reflector->isAbstract()) {
99
+                } elseif (!$reflector->isAbstract()) {
100 100
                     throw new GeneratorException(_('La clase definida debe ser abstracta'), 501);
101 101
                 }
102
-            } else {
102
+            }else {
103 103
                 throw new GeneratorException(_('La clase definida para extender la API no existe'), 501);
104 104
             }
105 105
         }
Please login to merge, or discard this patch.
src/base/Cache.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     /**
148 148
      * Método que guarda en fichero los datos pasados
149
-     * @param $path
149
+     * @param string $path
150 150
      * @param $data
151 151
      * @param int $transform
152 152
      * @param boolean $absolute
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
     /**
203 203
      * Método estático que revisa si se necesita cachear la respuesta de un servicio o no
204
-     * @return integer|boolean
204
+     * @return integer
205 205
      */
206 206
     public static function needCache()
207 207
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         GeneratorHelper::createDir(dirname($path));
47 47
         if (false === FileHelper::writeFile($path, $data)) {
48
-            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ') . $path);
48
+            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ').$path);
49 49
         }
50 50
     }
51 51
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function getDataFromFile($path, $transform = Cache::TEXT, $absolute = false)
60 60
     {
61 61
         $data = null;
62
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
62
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
63 63
         if (file_exists($absolutePath)) {
64 64
             $data = FileHelper::readFile($absolutePath);
65 65
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     private function hasExpiredCache($path, $expires = 300, $absolute = false)
77 77
     {
78
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
78
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
79 79
         $lasModificationDate = filemtime($absolutePath);
80 80
         return ($lasModificationDate + $expires <= time());
81 81
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     public function storeData($path, $data, $transform = Cache::TEXT, $absolute = false, $expires = 600)
142 142
     {
143 143
         $data = Cache::transformData($data, $transform);
144
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
144
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
145 145
         $this->saveTextToFile($data, $absolutePath);
146 146
     }
147 147
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
     public function readFromCache($path, $expires = 300, callable $function, $transform = Cache::TEXT)
157 157
     {
158 158
         $data = null;
159
-        if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) {
159
+        if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) {
160 160
             if (null !== $function && $this->hasExpiredCache($path, $expires)) {
161 161
                 $data = call_user_func($function);
162 162
                 $this->storeData($path, $data, $transform, false, $expires);
163
-            } else {
163
+            }else {
164 164
                 $data = $this->getDataFromFile($path, $transform);
165 165
             }
166 166
         }
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
         $action = Security::getInstance()->getSessionKey("__CACHE__");
203 203
         if (null !== $action && $action["cache"] > 0) {
204 204
             $class = GeneratorHelper::extractClassFromNamespace($action['class']);
205
-            $filename = sha1($action["http"] . " " . $action["slug"]);
206
-            $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2);
207
-            $hashPath = $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR;
205
+            $filename = sha1($action["http"]." ".$action["slug"]);
206
+            $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2);
207
+            $hashPath = $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR;
208 208
         }
209 209
         return [$hashPath, $filename];
210 210
     }
Please login to merge, or discard this patch.
src/base/config/Config.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     protected function init()
76 76
     {
77
-        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) {
77
+        if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) {
78 78
             $this->loadConfigData();
79 79
         }
80 80
         return $this;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
             $final_data = array_filter($final_data, function($key, $value) {
183 183
                 return in_array($key, Config::$required) || !empty($value);
184 184
             }, ARRAY_FILTER_USE_BOTH);
185
-            $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT)));
185
+            $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT)));
186 186
             Config::getInstance()->loadConfigData();
187 187
             $saved = true;
188
-        } catch (ConfigException $e) {
188
+        }catch (ConfigException $e) {
189 189
             Logger::log($e->getMessage(), LOG_ERR);
190 190
         }
191 191
         return $saved;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      */
218 218
     public function loadConfigData()
219 219
     {
220
-        $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: [];
220
+        $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: [];
221 221
         $this->debug = (array_key_exists('debug', $this->config)) ? (bool)$this->config['debug'] : FALSE;
222 222
     }
223 223
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     /**
193 193
      * Method that returns a config value
194 194
      * @param string $param
195
-     * @param mixed $defaultValue
195
+     * @param string $defaultValue
196 196
      *
197 197
      * @return mixed|null
198 198
      */
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     /**
231 231
      * Static wrapper for extracting params
232 232
      * @param string $key
233
-     * @param mixed|null $defaultValue
233
+     * @param string|boolean $defaultValue
234 234
      * @return mixed|null
235 235
      */
236 236
     public static function getParam($key, $defaultValue = null)
Please login to merge, or discard this patch.
src/base/types/Api.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -603,6 +603,9 @@  discard block
 block discarded – undo
603 603
         $this->con->useDebug($this->debug);
604 604
     }
605 605
 
606
+    /**
607
+     * @return string
608
+     */
606 609
     private function getApi()
607 610
     {
608 611
         $model = explode("\\", $this->getModelNamespace());
@@ -610,6 +613,9 @@  discard block
 block discarded – undo
610 613
         return $model[count($model) - 1];
611 614
     }
612 615
 
616
+    /**
617
+     * @return string
618
+     */
613 619
     public function getDomain()
614 620
     {
615 621
         $model = explode("\\", $this->getModelNamespace());
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -14,12 +14,10 @@
 block discarded – undo
14 14
 use PSFS\base\Request;
15 15
 use PSFS\base\Router;
16 16
 use PSFS\base\Singleton;
17
-use PSFS\base\Template;
18 17
 use PSFS\base\types\helpers\ApiFormHelper;
19 18
 use PSFS\base\types\helpers\ApiHelper;
20 19
 use PSFS\base\types\traits\JsonTrait;
21 20
 use PSFS\base\types\traits\RouteTrait;
22
-use PSFS\base\types\traits\SingletonTrait;
23 21
 
24 22
 /**
25 23
  * Class Api
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      *
187 187
      * @param ModelCriteria $query
188 188
      */
189
-    private function addOrders(ModelCriteria &$query)
189
+    private function addOrders(ModelCriteria & $query)
190 190
     {
191 191
         $orderAdded = FALSE;
192 192
         $tableMap = $this->getTableMap();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                 $orderAdded = TRUE;
196 196
                 if ($direction === Order::ASC) {
197 197
                     $query->addAscendingOrderByColumn($column->getPhpName());
198
-                } else {
198
+                }else {
199 199
                     $query->addDescendingOrderByColumn($column->getPhpName());
200 200
                 }
201 201
             }
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
         $pks = $tableMap->getPrimaryKeys();
211 211
         if (count($pks) == 1) {
212 212
             $pks = array_keys($pks);
213
-            return $tableMap::TABLE_NAME . '.' . $pks[0];
214
-        } else {
213
+            return $tableMap::TABLE_NAME.'.'.$pks[0];
214
+        }else {
215 215
             throw new ApiException(_('El modelo de la API no está debidamente mapeado, no hay Primary Key o es compuesta'));
216 216
         }
217 217
     }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             }
243 243
             if (null !== $column) {
244 244
                 $this->extraColumns[$column->getFullyQualifiedName()] = self::API_LIST_NAME_FIELD;
245
-            } else {
245
+            }else {
246 246
                 $this->addClassListName($tableMap);
247 247
             }
248 248
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      *
254 254
      * @param ModelCriteria $query
255 255
      */
256
-    private function addExtraColumns(ModelCriteria &$query)
256
+    private function addExtraColumns(ModelCriteria & $query)
257 257
     {
258 258
         if (self::API_ACTION_LIST === $this->action) {
259 259
             $this->addDefaultListField();
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      *
272 272
      * @param ModelCriteria $query
273 273
      */
274
-    protected function joinTables(ModelCriteria &$query)
274
+    protected function joinTables(ModelCriteria & $query)
275 275
     {
276 276
         //TODO for specific implementations
277 277
     }
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
      *
294 294
      * @param ModelCriteria $query
295 295
      */
296
-    private function addFilters(ModelCriteria &$query)
296
+    private function addFilters(ModelCriteria & $query)
297 297
     {
298 298
         if (count($this->query) > 0) {
299 299
             $tableMap = $this->getTableMap();
300 300
             foreach ($this->query as $field => $value) {
301 301
                 if (self::API_COMBO_FIELD === $field) {
302 302
                     ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value);
303
-                } else {
303
+                }else {
304 304
                     ApiHelper::addModelField($tableMap, $query, $field, $value);
305 305
                 }
306 306
             }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     /**
311 311
      * @param ModelCriteria $query
312 312
      */
313
-    private function checkReturnFields(ModelCriteria &$query)
313
+    private function checkReturnFields(ModelCriteria & $query)
314 314
     {
315 315
         $returnFields = $this->getRequest()->getQuery('__fields');
316 316
         if (null !== $returnFields) {
@@ -346,10 +346,10 @@  discard block
 block discarded – undo
346 346
             list($page, $limit) = $this->extractPagination();
347 347
             if ($limit == -1) {
348 348
                 $this->list = $query->find($this->con);
349
-            } else {
349
+            }else {
350 350
                 $this->list = $query->paginate($page, $limit, $this->con);
351 351
             }
352
-        } catch (\Exception $e) {
352
+        }catch (\Exception $e) {
353 353
             Logger::log($e->getMessage(), LOG_ERR);
354 354
         }
355 355
     }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             $this->joinTables($query);
367 367
             $this->addExtraColumns($query);
368 368
             $this->model = $query->findPk($pk);
369
-        } catch (\Exception $e) {
369
+        }catch (\Exception $e) {
370 370
             Logger::getInstance(get_class($this))->errorLog($e->getMessage());
371 371
         }
372 372
     }
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
                 $saved = TRUE;
458 458
                 $model = $this->model->toArray();
459 459
             }
460
-        } catch (\Exception $e) {
461
-            $model = _('Ha ocurrido un error intentando guardar el elemento: ') . $e->getMessage();
460
+        }catch (\Exception $e) {
461
+            $model = _('Ha ocurrido un error intentando guardar el elemento: ').$e->getMessage();
462 462
             Logger::log($e->getMessage(), LOG_ERR);
463 463
         }
464 464
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
                     $this->model->delete($this->con);
489 489
                     $deleted = TRUE;
490 490
                 }
491
-            } catch (\Exception $e) {
491
+            }catch (\Exception $e) {
492 492
                 $message = _('Ha ocurrido un error intentando eliminar el elemento, por favor verifica que no tenga otros elementos relacionados');
493 493
                 Logger::getInstance(get_class($this->model))->errorLog($e->getMessage());
494 494
             }
@@ -523,14 +523,14 @@  discard block
 block discarded – undo
523 523
                     $updated = TRUE;
524 524
                     $status = 200;
525 525
                     $model = $this->model->toArray();
526
-                } else {
526
+                }else {
527 527
                     $model = _('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
528 528
                 }
529
-            } catch (\Exception $e) {
529
+            }catch (\Exception $e) {
530 530
                 $model = $e->getMessage();
531 531
                 Logger::getInstance(get_class($this->model))->errorLog($e->getMessage());
532 532
             }
533
-        } else {
533
+        }else {
534 534
             $model = _('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
535 535
         }
536 536
 
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
      */
543 543
     private function extractQuery()
544 544
     {
545
-        $queryReflector = new \ReflectionClass($this->getModelNamespace() . "Query");
545
+        $queryReflector = new \ReflectionClass($this->getModelNamespace()."Query");
546 546
         /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */
547 547
         $query = $queryReflector->getMethod('create')->invoke($this->con);
548 548
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
         if (null !== $this->con && $this->con->inTransaction()) {
587 587
             if ($status === 200) {
588 588
                 $this->con->commit();
589
-            } else {
589
+            }else {
590 590
                 $this->con->rollBack();
591 591
             }
592 592
         }
@@ -638,8 +638,8 @@  discard block
 block discarded – undo
638 638
             "domain" => $this->getDomain(),
639 639
             "listLabel" => self::API_LIST_NAME_FIELD,
640 640
             'modelId' => self::API_MODEL_KEY_FIELD,
641
-            'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-' . $this->getDomain() . '-' . $this->getApi()), TRUE)),
642
-            "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain() . '-' . 'api-' . $this->getApi() . "-pk"), TRUE)),
641
+            'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-'.$this->getDomain().'-'.$this->getApi()), TRUE)),
642
+            "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain().'-'.'api-'.$this->getApi()."-pk"), TRUE)),
643 643
         ), [], '');
644 644
     }
645 645
 
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
                 $total = $this->list->getNbResults();
680 680
                 $pages = $this->list->getLastPage();
681 681
             }
682
-        } catch (\Exception $e) {
682
+        }catch (\Exception $e) {
683 683
             Logger::getInstance(get_class($this))->errorLog($e->getMessage());
684 684
         }
685 685
 
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
         $return = array();
699 699
         if (NULL === $model && method_exists($model, 'toArray')) {
700 700
             $code = 404;
701
-        } else {
701
+        }else {
702 702
             $return = $model->toArray();
703 703
         }
704 704
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
         $pks = '';
714 714
         $sep = '';
715 715
         foreach ($tableMap->getPrimaryKeys() as $pk) {
716
-            $pks .= $sep . $pk->getFullyQualifiedName();
716
+            $pks .= $sep.$pk->getFullyQualifiedName();
717 717
             $sep = ', "|", ';
718 718
         }
719
-        $this->extraColumns['CONCAT("' . $tableMap->getPhpName() . ' #", ' . $pks . ')'] = self::API_LIST_NAME_FIELD;
719
+        $this->extraColumns['CONCAT("'.$tableMap->getPhpName().' #", '.$pks.')'] = self::API_LIST_NAME_FIELD;
720 720
     }
721 721
 }
Please login to merge, or discard this patch.
src/base/types/helpers/ApiFormHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
     public static function checkApiActions($namespace, $domain, $api) {
18 18
         $actions = [];
19 19
         $reflector = new \ReflectionClass($namespace);
20
-        if(null !== $reflector) {
21
-            foreach($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $apiAction) {
20
+        if (null !== $reflector) {
21
+            foreach ($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $apiAction) {
22 22
                 $docComments = $apiAction->getDocComment();
23 23
                 $action = self::extractAction($docComments);
24
-                if(null !== $action) {
24
+                if (null !== $action) {
25 25
                     list($route, $info) = RouterHelper::extractRouteInfo($apiAction, $api, $domain);
26 26
                     list($method, $cleanRoute) = RouterHelper::extractHttpRoute($route);
27 27
                     $formAction = new FormAction();
Please login to merge, or discard this patch.
src/base/dto/Form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
             $array['fields'][] = $field->__toArray();
27 27
         }
28 28
         $array['actions'] = [];
29
-        foreach($this->actions as $action) {
29
+        foreach ($this->actions as $action) {
30 30
             $array['actions'][] = $action->__toArray();
31 31
         }
32 32
         return $array;
Please login to merge, or discard this patch.