Passed
Push — master ( 6063b2...1b381e )
by Fran
03:05
created
src/base/types/helpers/Inspector.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
         ];
15 15
     }
16 16
 
17
+    /**
18
+     * @param string $name
19
+     */
17 20
     public static function stats($name = null) {
18 21
         self::$profiling[] = self::collect($name);
19 22
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     protected static function calculateStats(array $stats, $ts, $mem = 0, $files = 0) {
29 29
         return [
30 30
             'ts' => round($stats['ts'] - $ts, 4),
31
-            'mem' => round(($stats['mem'] - $mem) / 1024 / 1024, 4),
31
+            'mem' => round(($stats['mem'] - $mem)/1024/1024, 4),
32 32
             'files' => $stats['files'] - $files,
33 33
             'name' => $stats['name'],
34 34
         ];
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $ts = defined('PSFS_START_TS') ? PSFS_START_TS : 0;
43 43
         $mem = defined('PSFS_START_MEM') ? PSFS_START_MEM : 0;
44 44
         $files = 0;
45
-        foreach(self::$profiling as $key => &$value) {
45
+        foreach (self::$profiling as $key => &$value) {
46 46
             $value = self::calculateStats($value, $ts, $mem, $files);
47 47
         }
48 48
         self::$profiling[] = self::calculateStats(self::collect('Profiling collect ends'), $ts, $mem, $files);
Please login to merge, or discard this patch.
src/base/types/traits/JsonTrait.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
      * @param mixed $response
19 19
      * @param int $statusCode
20 20
      *
21
-     * @return mixed JSON
21
+     * @return string|null JSON
22 22
      */
23 23
     public function json($response, $statusCode = 200)
24 24
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function json($response, $statusCode = 200)
25 25
     {
26
-        if(Config::getParam('profiling.enable')) {
27
-            if(is_array($response)) {
26
+        if (Config::getParam('profiling.enable')) {
27
+            if (is_array($response)) {
28 28
                 $response['profiling'] = Inspector::getStats();
29
-            } elseif($response instanceof JsonResponse) {
29
+            } elseif ($response instanceof JsonResponse) {
30 30
                 $response = ProfilingJsonResponse::createFromPrevious($response, Inspector::getStats());
31 31
             }
32 32
         }
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
         $this->decodeJsonReponse($response);
35 35
 
36 36
         $mask = JSON_UNESCAPED_UNICODE | JSON_BIGINT_AS_STRING;
37
-        if(Config::getParam('output.json.strict_numbers')) {
37
+        if (Config::getParam('output.json.strict_numbers')) {
38 38
             $mask = JSON_UNESCAPED_UNICODE | JSON_BIGINT_AS_STRING | JSON_NUMERIC_CHECK;
39 39
         }
40 40
 
41 41
         $data = json_encode($response, $mask);
42
-        if(Config::getParam('angular.protection', false)) {
43
-            $data = ")]}',\n" . $data;
42
+        if (Config::getParam('angular.protection', false)) {
43
+            $data = ")]}',\n".$data;
44 44
         }
45 45
         $this->setStatus($statusCode);
46 46
         ResponseHelper::setDebugHeaders([]);
Please login to merge, or discard this patch.
src/bootstrap.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@
 block discarded – undo
3 3
 
4 4
 if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__);
5 5
 if (preg_match('/vendor/', SOURCE_DIR)) {
6
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
7
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
8
-} else {
9
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
10
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
6
+    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');
7
+    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src');
8
+}else {
9
+    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..');
10
+    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules');
11 11
 }
12
-if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor');
13
-if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
14
-if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
15
-if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
16
-if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
12
+if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor');
13
+if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
14
+if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache');
15
+if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config');
16
+if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html');
17 17
 
18 18
 
19 19
 /**
Please login to merge, or discard this patch.
Braces   +31 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,19 +4,39 @@
 block discarded – undo
4 4
 defined('PSFS_START_MEM') or define('PSFS_START_MEM', memory_get_usage());
5 5
 defined('PSFS_START_TS') or define('PSFS_START_TS', microtime(true));
6 6
 
7
-if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__);
7
+if (!defined('SOURCE_DIR')) {
8
+    define('SOURCE_DIR', __DIR__);
9
+}
8 10
 if (preg_match('/vendor/', SOURCE_DIR)) {
9
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
10
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
11
-} else {
12
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
13
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
11
+    if (!defined('BASE_DIR')) {
12
+        define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
13
+    }
14
+    if (!defined('CORE_DIR')) {
15
+        define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
16
+    }
17
+    } else {
18
+    if (!defined('BASE_DIR')) {
19
+        define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
20
+    }
21
+    if (!defined('CORE_DIR')) {
22
+        define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
23
+    }
24
+    }
25
+if (!defined('VENDOR_DIR')) {
26
+    define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor');
27
+}
28
+if (!defined('LOG_DIR')) {
29
+    define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
30
+}
31
+if (!defined('CACHE_DIR')) {
32
+    define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
33
+}
34
+if (!defined('CONFIG_DIR')) {
35
+    define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
36
+}
37
+if (!defined('WEB_DIR')) {
38
+    define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
14 39
 }
15
-if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor');
16
-if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
17
-if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
18
-if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
19
-if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
20 40
 
21 41
 
22 42
 /**
Please login to merge, or discard this patch.
src/base/types/helpers/FileHelper.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class FileHelper {
10 10
     /**
11
-     * @param mixed $data
11
+     * @param string $data
12 12
      * @param string $path
13 13
      * @return int
14 14
      */
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     /**
20 20
      * @param string $path
21
-     * @return mixed|bool
21
+     * @return string|false
22 22
      */
23 23
     public static function readFile($path) {
24 24
         $data = false;
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     /**
54
-     * @param $path
55
-     * @return bool
54
+     * @param string $path
55
+     * @return boolean|null
56 56
      */
57 57
     public static function deleteDir($path) {
58 58
         (new Filesystem())->remove($path);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public static function readFile($path) {
24 24
         $data = false;
25
-        if(file_exists($path)) {
25
+        if (file_exists($path)) {
26 26
             $data = file_get_contents($path);
27 27
         }
28 28
         return $data;
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @return string
36 36
      */
37 37
     public static function generateHashFilename($verb, $slug, array $query = []) {
38
-        return sha1(strtolower($verb) . " " . $slug . " " . strtolower(http_build_query($query)));
38
+        return sha1(strtolower($verb)." ".$slug." ".strtolower(http_build_query($query)));
39 39
     }
40 40
 
41 41
     /**
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     public static function generateCachePath(array $action, array $query = []) {
47 47
         $class = GeneratorHelper::extractClassFromNamespace($action['class']);
48 48
         $filename = self::generateHashFilename($action["http"], $action["slug"], $query);
49
-        $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2);
50
-        return $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR;
49
+        $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2);
50
+        return $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR;
51 51
     }
52 52
 
53 53
     /**
Please login to merge, or discard this patch.
src/base/config/Config.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@
 block discarded – undo
196 196
     /**
197 197
      * Method that returns a config value
198 198
      * @param string $param
199
-     * @param mixed $defaultValue
199
+     * @param string $defaultValue
200 200
      *
201 201
      * @return mixed|null
202 202
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     protected function init()
74 74
     {
75
-        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) {
75
+        if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) {
76 76
             $this->loadConfigData();
77 77
         }
78 78
         return $this;
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
             $final_data = array_filter($final_data, function($key, $value) {
189 189
                 return in_array($key, Config::$required) || !empty($value);
190 190
             }, ARRAY_FILTER_USE_BOTH);
191
-            $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT)));
191
+            $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($final_data, JSON_PRETTY_PRINT)));
192 192
             Config::getInstance()->loadConfigData();
193 193
             $saved = true;
194
-        } catch (ConfigException $e) {
194
+        }catch (ConfigException $e) {
195 195
             Logger::log($e->getMessage(), LOG_ERR);
196 196
         }
197 197
         return $saved;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function loadConfigData()
225 225
     {
226
-        $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: [];
226
+        $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: [];
227 227
         $this->debug = (array_key_exists('debug', $this->config)) ? (bool)$this->config['debug'] : FALSE;
228 228
     }
229 229
 
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public static function getParam($key, $defaultValue = null, $module = null)
246 246
     {
247
-        if(null !== $module) {
248
-            return self::getParam(strtolower($module) . '.' . $key, self::getParam($key, $defaultValue));
249
-        } else {
247
+        if (null !== $module) {
248
+            return self::getParam(strtolower($module).'.'.$key, self::getParam($key, $defaultValue));
249
+        }else {
250 250
             $param = Config::getInstance()->get($key);
251 251
             return (null !== $param) ? $param : $defaultValue;
252 252
         }
Please login to merge, or discard this patch.
src/base/types/helpers/I18nHelper.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
     /**
20 20
      * @param string $default
21
-     * @return array|mixed|string
21
+     * @return string
22 22
      */
23 23
     private static function extractLocale($default = null)
24 24
     {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
                 list($BrowserLocales[$i]) = explode(";", $BrowserLocales[$i]); //trick for "en;q=0.8"
31 31
             }
32 32
             $locale = array_shift($BrowserLocales);
33
-        } else {
33
+        }else {
34 34
             $locale = strtolower($locale);
35 35
         }
36 36
         if (false !== strpos($locale, '_')) {
37 37
             $locale = explode('_', $locale);
38 38
             if ($locale[0] == 'en') {
39
-                $locale = $locale[0] . '_GB';
40
-            } else {
41
-                $locale = $locale[0] . '_' . strtoupper($locale[1]);
39
+                $locale = $locale[0].'_GB';
40
+            }else {
41
+                $locale = $locale[0].'_'.strtoupper($locale[1]);
42 42
             }
43
-        } else {
43
+        }else {
44 44
             if (strtolower($locale) === 'en') {
45 45
                 $locale = 'en_GB';
46
-            } else {
47
-                $locale = $locale . '_' . strtoupper($locale);
46
+            }else {
47
+                $locale = $locale.'_'.strtoupper($locale);
48 48
             }
49 49
         }
50 50
         if (!in_array($locale, self::$langs)) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $translations = array();
66 66
         if (file_exists($absoluteTranslationFileName)) {
67 67
             @include($absoluteTranslationFileName);
68
-        } else {
68
+        }else {
69 69
             Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE);
70 70
         }
71 71
 
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
     public static function setLocale()
79 79
     {
80 80
         $locale = self::extractLocale('es_ES');
81
-        Logger::log('Set locale to project [' . $locale . ']');
81
+        Logger::log('Set locale to project ['.$locale.']');
82 82
         // Load translations
83
-        putenv("LC_ALL=" . $locale);
83
+        putenv("LC_ALL=".$locale);
84 84
         setlocale(LC_ALL, $locale);
85 85
         // Load the locale path
86
-        $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale';
87
-        Logger::log('Set locale dir ' . $locale_path);
86
+        $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale';
87
+        Logger::log('Set locale dir '.$locale_path);
88 88
         GeneratorHelper::createDir($locale_path);
89 89
         bindtextdomain('translations', $locale_path);
90 90
         textdomain('translations');
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public static function checkI18Class($namespace) {
121 121
         $isI18n = false;
122
-        if(preg_match('/I18n$/i', $namespace)) {
122
+        if (preg_match('/I18n$/i', $namespace)) {
123 123
             $parentClass = preg_replace('/I18n$/i', '', $namespace);
124
-            if(Router::exists($parentClass)) {
124
+            if (Router::exists($parentClass)) {
125 125
                 $isI18n = true;
126 126
             }
127 127
         }
Please login to merge, or discard this patch.
src/base/Template.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $dump = '';
114 114
         try {
115 115
             $dump = $this->tpl->render($tpl, $vars);
116
-        } catch (\Exception $e) {
116
+        }catch (\Exception $e) {
117 117
             Logger::log($e->getMessage(), LOG_ERR);
118 118
         }
119 119
         return $dump;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function regenerateTemplates()
141 141
     {
142 142
         $this->generateTemplatesCache();
143
-        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", Cache::JSON, true);
143
+        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", Cache::JSON, true);
144 144
         $translations = [];
145 145
         if (is_array($domains)) {
146 146
             $translations = $this->parsePathTranslations($domains);
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
             // force compilation
163 163
             if ($file->isFile()) {
164 164
                 try {
165
-                    $this->tpl->load(str_replace($tplDir . '/', '', $file));
166
-                } catch (\Exception $e) {
165
+                    $this->tpl->load(str_replace($tplDir.'/', '', $file));
166
+                }catch (\Exception $e) {
167 167
                     Logger::log($e->getMessage(), LOG_ERR, ['file' => $e->getFile(), 'line' => $e->getLine()]);
168 168
                 }
169 169
             }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             'getFlash' => TemplateFunctions::GET_FLASH_FUNCTION,
225 225
             'getQuery' => TemplateFunctions::GET_QUERY_FUNCTION,
226 226
         ];
227
-        foreach($functions as $name => $function) {
227
+        foreach ($functions as $name => $function) {
228 228
             $this->addTemplateFunction($name, $function);
229 229
         }
230 230
     }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     private function loadDomains()
245 245
     {
246
-        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true);
246
+        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', Cache::JSON, true);
247 247
         if (null !== $domains) {
248 248
             foreach ($domains as $domain => $paths) {
249 249
                 $this->addPath($paths['template'], preg_replace('/(@|\/)/', '', $domain));
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $loader = new \Twig_Loader_Filesystem(GeneratorHelper::getTemplatePath());
260 260
         $this->tpl = new \Twig_Environment($loader, array(
261
-            'cache' => CACHE_DIR . DIRECTORY_SEPARATOR . 'twig',
261
+            'cache' => CACHE_DIR.DIRECTORY_SEPARATOR.'twig',
262 262
             'debug' => (bool)$this->debug,
263 263
             'auto_reload' => Config::getParam('twig.autoreload', TRUE),
264 264
         ));
Please login to merge, or discard this patch.
src/base/config/ConfigForm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,9 +82,9 @@
 block discarded – undo
82 82
             "class" => "btn-warning md-default",
83 83
             "icon" => "fa-plus",
84 84
         ];
85
-        if(Config::getParam('admin.version', 'v1') === 'v1') {
86
-            $add["onclick"] = "javascript:addNewField(document.getElementById('" . $this->getName() . "'));";
87
-        } else {
85
+        if (Config::getParam('admin.version', 'v1') === 'v1') {
86
+            $add["onclick"] = "javascript:addNewField(document.getElementById('".$this->getName()."'));";
87
+        }else {
88 88
             $add["ng-click"] = "addNewField()";
89 89
         }
90 90
         $this->addButton('submit', _("Guardar configuración"), "submit", array(
Please login to merge, or discard this patch.
src/base/types/traits/Api/MutationTrait.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -65,21 +65,21 @@  discard block
 block discarded – undo
65 65
         if (count($pks) == 1) {
66 66
             $pks = array_keys($pks);
67 67
             return [
68
-                $tableMap::TABLE_NAME . '.' . $pks[0] => Api::API_MODEL_KEY_FIELD
68
+                $tableMap::TABLE_NAME.'.'.$pks[0] => Api::API_MODEL_KEY_FIELD
69 69
             ];
70 70
         } elseif (count($pks) > 1) {
71 71
             $apiPks = [];
72 72
             $principal = '';
73 73
             $sep = 'CONCAT(';
74 74
             foreach ($pks as $pk) {
75
-                $apiPks[$tableMap::TABLE_NAME . '.' . $pk->getName()] = $pk->getPhpName();
76
-                $principal .= $sep . $tableMap::TABLE_NAME . '.' . $pk->getName();
77
-                $sep = ', "' . Api::API_PK_SEPARATOR . '", ';
75
+                $apiPks[$tableMap::TABLE_NAME.'.'.$pk->getName()] = $pk->getPhpName();
76
+                $principal .= $sep.$tableMap::TABLE_NAME.'.'.$pk->getName();
77
+                $sep = ', "'.Api::API_PK_SEPARATOR.'", ';
78 78
             }
79 79
             $principal .= ')';
80 80
             $apiPks[$principal] = Api::API_MODEL_KEY_FIELD;
81 81
             return $apiPks;
82
-        } else {
82
+        }else {
83 83
             throw new ApiException(_('El modelo de la API no está debidamente mapeado, no hay Primary Key o es compuesta'));
84 84
         }
85 85
     }
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
         $pks = '';
103 103
         $sep = '';
104 104
         foreach ($tableMap->getPrimaryKeys() as $pk) {
105
-            $pks .= $sep . $pk->getFullyQualifiedName();
105
+            $pks .= $sep.$pk->getFullyQualifiedName();
106 106
             $sep = ', "|", ';
107 107
         }
108
-        $this->extraColumns['CONCAT("' . $tableMap->getPhpName() . ' #", ' . $pks . ')'] = Api::API_LIST_NAME_FIELD;
108
+        $this->extraColumns['CONCAT("'.$tableMap->getPhpName().' #", '.$pks.')'] = Api::API_LIST_NAME_FIELD;
109 109
     }
110 110
 
111 111
     /**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             }
128 128
             if (null !== $column) {
129 129
                 $this->extraColumns[$column->getFullyQualifiedName()] = Api::API_LIST_NAME_FIELD;
130
-            } else {
130
+            }else {
131 131
                 $this->addClassListName($tableMap);
132 132
             }
133 133
         }
@@ -139,22 +139,22 @@  discard block
 block discarded – undo
139 139
      * @param ModelCriteria $query
140 140
      * @param string $action
141 141
      */
142
-    private function addExtraColumns(ModelCriteria &$query, $action)
142
+    private function addExtraColumns(ModelCriteria & $query, $action)
143 143
     {
144 144
         if (Api::API_ACTION_LIST === $action) {
145 145
             $this->addDefaultListField();
146 146
             $this->addPkToList();
147 147
         }
148 148
         if (!empty($this->extraColumns)) {
149
-            if(Config::getParam('api.extrafields.compat', true)) {
149
+            if (Config::getParam('api.extrafields.compat', true)) {
150 150
                 $fields = array_values($this->extraColumns);
151
-            } else {
151
+            }else {
152 152
                 $returnFields = Request::getInstance()->getQuery(Api::API_FIELDS_RESULT_FIELD);
153 153
                 $fields = explode(',', $returnFields ?: '');
154 154
                 $fields[] = self::API_MODEL_KEY_FIELD;
155 155
             }
156 156
             foreach ($this->extraColumns as $expression => $columnName) {
157
-                if(empty($fields) || in_array($columnName, $fields)) {
157
+                if (empty($fields) || in_array($columnName, $fields)) {
158 158
                     $query->withColumn($expression, $columnName);
159 159
                 }
160 160
             }
@@ -182,21 +182,21 @@  discard block
 block discarded – undo
182 182
     /**
183 183
      * @param ModelCriteria $query
184 184
      */
185
-    protected function checkI18n(ModelCriteria &$query)
185
+    protected function checkI18n(ModelCriteria & $query)
186 186
     {
187 187
         $this->extractApiLang();
188 188
         $model = $this->getModelNamespace();
189
-        $modelI18n = $model . 'I18n';
189
+        $modelI18n = $model.'I18n';
190 190
         if (method_exists($query, 'useI18nQuery')) {
191 191
             $query->useI18nQuery($this->lang);
192
-            $modelI18nTableMapClass = str_replace('\\Models\\', '\\Models\\Map\\', $modelI18n) . 'TableMap';
192
+            $modelI18nTableMapClass = str_replace('\\Models\\', '\\Models\\Map\\', $modelI18n).'TableMap';
193 193
             /** @var TableMap $modelI18nTableMap */
194 194
             $modelI18nTableMap = $modelI18nTableMapClass::getTableMap();
195
-            foreach($modelI18nTableMap->getColumns() as $columnMap) {
196
-                if(!$columnMap->isPrimaryKey()) {
197
-                    $query->withColumn($modelI18nTableMapClass::TABLE_NAME . '.' . $columnMap->getName(), $columnMap->getPhpName());
198
-                } elseif(!$columnMap->isForeignKey()) {
199
-                    $query->withColumn('IFNULL(' . $modelI18nTableMapClass::TABLE_NAME . '.' . $columnMap->getName() . ', "'.$this->lang.'")', $columnMap->getPhpName());
195
+            foreach ($modelI18nTableMap->getColumns() as $columnMap) {
196
+                if (!$columnMap->isPrimaryKey()) {
197
+                    $query->withColumn($modelI18nTableMapClass::TABLE_NAME.'.'.$columnMap->getName(), $columnMap->getPhpName());
198
+                } elseif (!$columnMap->isForeignKey()) {
199
+                    $query->withColumn('IFNULL('.$modelI18nTableMapClass::TABLE_NAME.'.'.$columnMap->getName().', "'.$this->lang.'")', $columnMap->getPhpName());
200 200
                 }
201 201
             }
202 202
         }
@@ -206,23 +206,23 @@  discard block
 block discarded – undo
206 206
      * @param ActiveRecordInterface $model
207 207
      * @param array $data
208 208
      */
209
-    protected function hydrateModelFromRequest(ActiveRecordInterface &$model, array $data = []) {
209
+    protected function hydrateModelFromRequest(ActiveRecordInterface & $model, array $data = []) {
210 210
         $model->fromArray($data);
211 211
         $tableMap = $this->getTableMap();
212 212
         try {
213
-            $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n');
214
-            if(null !== $relateI18n) {
213
+            $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n');
214
+            if (null !== $relateI18n) {
215 215
                 $i18NTableMap = $relateI18n->getLocalTable();
216
-                foreach($i18NTableMap->getColumns() as $columnMap) {
217
-                    $method = 'set' . $columnMap->getPhpName();
218
-                    if(!($columnMap->isPrimaryKey() && $columnMap->isForeignKey())
216
+                foreach ($i18NTableMap->getColumns() as $columnMap) {
217
+                    $method = 'set'.$columnMap->getPhpName();
218
+                    if (!($columnMap->isPrimaryKey() && $columnMap->isForeignKey())
219 219
                         &&array_key_exists($columnMap->getPhpName(), $data)
220 220
                         && method_exists($model, $method)) {
221 221
                         $model->$method($data[$columnMap->getPhpName()]);
222 222
                     }
223 223
                 }
224 224
             }
225
-        } catch(\Exception $e) {
225
+        }catch (\Exception $e) {
226 226
             Logger::log($e->getMessage(), LOG_WARNING);
227 227
         }
228 228
     }
Please login to merge, or discard this patch.