Passed
Push — master ( aae343...cfdf4c )
by Fran
02:56
created
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   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function json($response, $statusCode = 200)
24 24
     {
25
-        if(Config::getParam('profiling.enable')) {
26
-            if(is_array($response)) {
25
+        if (Config::getParam('profiling.enable')) {
26
+            if (is_array($response)) {
27 27
                 $response['profiling'] = Inspector::getStats();
28
-            } elseif($response instanceof JsonResponse) {
28
+            } elseif ($response instanceof JsonResponse) {
29 29
                 $response = ProfilingJsonResponse::createFromPrevious($response, Inspector::getStats());
30 30
             }
31 31
         }
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
         $this->decodeJsonReponse($response);
34 34
 
35 35
         $data = json_encode($response, JSON_UNESCAPED_UNICODE | JSON_BIGINT_AS_STRING | JSON_NUMERIC_CHECK);
36
-        if(Config::getParam('angular.protection', false)) {
37
-            $data = ")]}',\n" . $data;
36
+        if (Config::getParam('angular.protection', false)) {
37
+            $data = ")]}',\n".$data;
38 38
         }
39 39
         $this->setStatus($statusCode);
40 40
         return $this->output($data, "application/json");
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
@@ -1,19 +1,39 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace PSFS;
3 3
 
4
-if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__);
4
+if (!defined('SOURCE_DIR')) {
5
+    define('SOURCE_DIR', __DIR__);
6
+}
5 7
 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');
8
+    if (!defined('BASE_DIR')) {
9
+        define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
10
+    }
11
+    if (!defined('CORE_DIR')) {
12
+        define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
13
+    }
14
+    } else {
15
+    if (!defined('BASE_DIR')) {
16
+        define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
17
+    }
18
+    if (!defined('CORE_DIR')) {
19
+        define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
20
+    }
21
+    }
22
+if (!defined('VENDOR_DIR')) {
23
+    define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor');
24
+}
25
+if (!defined('LOG_DIR')) {
26
+    define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
27
+}
28
+if (!defined('CACHE_DIR')) {
29
+    define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
30
+}
31
+if (!defined('CONFIG_DIR')) {
32
+    define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
33
+}
34
+if (!defined('WEB_DIR')) {
35
+    define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
11 36
 }
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 37
 
18 38
 
19 39
 /**
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/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   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
                 list($BrowserLocales[$i]) = explode(";", $BrowserLocales[$i]); //trick for "en;q=0.8"
30 30
             }
31 31
             $locale = array_shift($BrowserLocales);
32
-        } else {
32
+        }else {
33 33
             $locale = strtolower($locale);
34 34
         }
35 35
         if (false !== strpos($locale, '_')) {
36 36
             $locale = explode('_', $locale);
37 37
             if ($locale[0] == 'en') {
38
-                $locale = $locale[0] . '_GB';
39
-            } else {
40
-                $locale = $locale[0] . '_' . strtoupper($locale[1]);
38
+                $locale = $locale[0].'_GB';
39
+            }else {
40
+                $locale = $locale[0].'_'.strtoupper($locale[1]);
41 41
             }
42
-        } else {
42
+        }else {
43 43
             if (strtolower($locale) === 'en') {
44 44
                 $locale = 'en_GB';
45
-            } else {
46
-                $locale = $locale . '_' . strtoupper($locale);
45
+            }else {
46
+                $locale = $locale.'_'.strtoupper($locale);
47 47
             }
48 48
         }
49 49
         if (!in_array($locale, self::$langs)) {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $translations = array();
65 65
         if (file_exists($absoluteTranslationFileName)) {
66 66
             @include($absoluteTranslationFileName);
67
-        } else {
67
+        }else {
68 68
             Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE);
69 69
         }
70 70
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
     public static function setLocale()
78 78
     {
79 79
         $locale = self::extractLocale('es_ES');
80
-        Logger::log('Set locale to project [' . $locale . ']');
80
+        Logger::log('Set locale to project ['.$locale.']');
81 81
         // Load translations
82
-        putenv("LC_ALL=" . $locale);
82
+        putenv("LC_ALL=".$locale);
83 83
         setlocale(LC_ALL, $locale);
84 84
         // Load the locale path
85
-        $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale';
86
-        Logger::log('Set locale dir ' . $locale_path);
85
+        $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale';
86
+        Logger::log('Set locale dir '.$locale_path);
87 87
         GeneratorHelper::createDir($locale_path);
88 88
         bindtextdomain('translations', $locale_path);
89 89
         textdomain('translations');
Please login to merge, or discard this patch.
src/base/types/traits/Api/MutationTrait.php 1 patch
Spacing   +24 added lines, -24 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,7 +139,7 @@  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();
@@ -173,21 +173,21 @@  discard block
 block discarded – undo
173 173
     /**
174 174
      * @param ModelCriteria $query
175 175
      */
176
-    protected function checkI18n(ModelCriteria &$query)
176
+    protected function checkI18n(ModelCriteria & $query)
177 177
     {
178 178
         $this->extractApiLang();
179 179
         $model = $this->getModelNamespace();
180
-        $modelI18n = $model . 'I18n';
180
+        $modelI18n = $model.'I18n';
181 181
         if (method_exists($query, 'useI18nQuery')) {
182 182
             $query->useI18nQuery($this->lang);
183
-            $modelI18nTableMapClass = str_replace('\\Models\\', '\\Models\\Map\\', $modelI18n) . 'TableMap';
183
+            $modelI18nTableMapClass = str_replace('\\Models\\', '\\Models\\Map\\', $modelI18n).'TableMap';
184 184
             /** @var TableMap $modelI18nTableMap */
185 185
             $modelI18nTableMap = $modelI18nTableMapClass::getTableMap();
186
-            foreach($modelI18nTableMap->getColumns() as $columnMap) {
187
-                if(!$columnMap->isPrimaryKey()) {
188
-                    $query->withColumn($modelI18nTableMapClass::TABLE_NAME . '.' . $columnMap->getName(), $columnMap->getPhpName());
189
-                } elseif(!$columnMap->isForeignKey()) {
190
-                    $query->withColumn('IFNULL(' . $modelI18nTableMapClass::TABLE_NAME . '.' . $columnMap->getName() . ', "'.$this->lang.'")', $columnMap->getPhpName());
186
+            foreach ($modelI18nTableMap->getColumns() as $columnMap) {
187
+                if (!$columnMap->isPrimaryKey()) {
188
+                    $query->withColumn($modelI18nTableMapClass::TABLE_NAME.'.'.$columnMap->getName(), $columnMap->getPhpName());
189
+                } elseif (!$columnMap->isForeignKey()) {
190
+                    $query->withColumn('IFNULL('.$modelI18nTableMapClass::TABLE_NAME.'.'.$columnMap->getName().', "'.$this->lang.'")', $columnMap->getPhpName());
191 191
                 }
192 192
             }
193 193
         }
@@ -197,23 +197,23 @@  discard block
 block discarded – undo
197 197
      * @param ActiveRecordInterface $model
198 198
      * @param array $data
199 199
      */
200
-    protected function hydrateModelFromRequest(ActiveRecordInterface &$model, array $data = []) {
200
+    protected function hydrateModelFromRequest(ActiveRecordInterface & $model, array $data = []) {
201 201
         $model->fromArray($data);
202 202
         $tableMap = $this->getTableMap();
203 203
         try {
204
-            $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n');
205
-            if(null !== $relateI18n) {
204
+            $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n');
205
+            if (null !== $relateI18n) {
206 206
                 $i18NTableMap = $relateI18n->getLocalTable();
207
-                foreach($i18NTableMap->getColumns() as $columnMap) {
208
-                    $method = 'set' . $columnMap->getPhpName();
209
-                    if(!($columnMap->isPrimaryKey() && $columnMap->isForeignKey())
207
+                foreach ($i18NTableMap->getColumns() as $columnMap) {
208
+                    $method = 'set'.$columnMap->getPhpName();
209
+                    if (!($columnMap->isPrimaryKey() && $columnMap->isForeignKey())
210 210
                         &&array_key_exists($columnMap->getPhpName(), $data)
211 211
                         && method_exists($model, $method)) {
212 212
                         $model->$method($data[$columnMap->getPhpName()]);
213 213
                     }
214 214
                 }
215 215
             }
216
-        } catch(\Exception $e) {
216
+        }catch (\Exception $e) {
217 217
             Logger::log($e->getMessage(), LOG_WARNING);
218 218
         }
219 219
     }
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/Security.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             session_start();
74 74
         }
75 75
         // Fix for phpunits
76
-        if(!isset($_SESSION)) {
76
+        if (!isset($_SESSION)) {
77 77
             $_SESSION = [];
78 78
         }
79 79
     }
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $saved = true;
135 135
         try {
136
-            $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true) ?: [];
137
-            $admins[$user['username']]['hash'] = sha1($user['username'] . $user['password']);
136
+            $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true) ?: [];
137
+            $admins[$user['username']]['hash'] = sha1($user['username'].$user['password']);
138 138
             $admins[$user['username']]['profile'] = $user['profile'];
139 139
 
140
-            Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', $admins, Cache::JSONGZ, true);
141
-        } catch(\Exception $e) {
140
+            Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', $admins, Cache::JSONGZ, true);
141
+        }catch (\Exception $e) {
142 142
             Logger::log($e->getMessage(), LOG_ERR);
143 143
             $saved = false;
144 144
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function getAdmins()
177 177
     {
178
-        return Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true);
178
+        return Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true);
179 179
     }
180 180
 
181 181
     /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                 }
204 204
                 if (!empty($user) && !empty($admins[$user])) {
205 205
                     $auth = $admins[$user]['hash'];
206
-                    $this->authorized = ($auth == sha1($user . $pass));
206
+                    $this->authorized = ($auth == sha1($user.$pass));
207 207
                     if ($this->authorized) {
208 208
                         $this->admin = array(
209 209
                             'alias' => $user,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                         );
212 212
                         $this->setSessionKey(self::ADMIN_ID_TOKEN, serialize($this->admin));
213 213
                     }
214
-                } else {
214
+                }else {
215 215
                     $this->admin = null;
216 216
                     $this->setSessionKey(self::ADMIN_ID_TOKEN, null);
217 217
                 }
Please login to merge, or discard this patch.
src/base/dto/Dto.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@
 block discarded – undo
35 35
                 /** @var \ReflectionProperty $property */
36 36
                 foreach ($properties as $property) {
37 37
                     $value = $property->getValue($this);
38
-                    if(is_object($value) && method_exists($value, 'toArray')) {
38
+                    if (is_object($value) && method_exists($value, 'toArray')) {
39 39
                         $dto[$property->getName()] = $value->toArray();
40
-                    } else {
40
+                    }else {
41 41
                         $dto[$property->getName()] = $property->getValue($this);
42 42
                     }
43 43
                 }
44 44
             }
45
-        } catch (\Exception $e) {
46
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
45
+        }catch (\Exception $e) {
46
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
47 47
         }
48 48
         return $dto;
49 49
     }
Please login to merge, or discard this patch.
src/controller/GeneratorController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function generateModule()
36 36
     {
37
-        Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri());
37
+        Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri());
38 38
         /* @var $form \PSFS\base\config\ConfigForm */
39 39
         $form = new ModuleForm();
40 40
         $form->build();
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
                 $this->gen->createStructureModule($module, false, $type, $apiClass);
66 66
                 Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente")));
67 67
                 Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true));
68
-            } catch (\Exception $e) {
69
-                Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
68
+            }catch (\Exception $e) {
69
+                Logger::getInstance()->infoLog($e->getMessage()." [".$e->getFile().":".$e->getLine()."]");
70 70
                 Security::getInstance()->setFlash("callback_message", $e->getMessage());
71 71
             }
72 72
         }
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 
78 78
     public static function createRoot($path = WEB_DIR, OutputInterface $output = null) {
79 79
 
80
-        if(null === $output) {
80
+        if (null === $output) {
81 81
             $output = new ConsoleOutput();
82 82
         }
83 83
 
84 84
         GeneratorHelper::createDir($path);
85 85
         $paths = array("js", "css", "img", "media", "font");
86 86
         foreach ($paths as $htmlPath) {
87
-            GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath);
87
+            GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath);
88 88
         }
89 89
 
90 90
         // Generates the root needed files
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
             'robots' => 'robots.txt',
97 97
         ];
98 98
         foreach ($files as $templates => $filename) {
99
-            $text = Template::getInstance()->dump("generator/html/" . $templates . '.html.twig');
100
-            if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) {
101
-                $output->writeln('Can\t create the file ' . $filename);
102
-            } else {
103
-                $output->writeln($filename . ' created successfully');
99
+            $text = Template::getInstance()->dump("generator/html/".$templates.'.html.twig');
100
+            if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) {
101
+                $output->writeln('Can\t create the file '.$filename);
102
+            }else {
103
+                $output->writeln($filename.' created successfully');
104 104
             }
105 105
         }
106 106
 
107 107
         //Export base locale translations
108
-        if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) {
109
-            GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
110
-            GeneratorService::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
108
+        if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) {
109
+            GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
110
+            GeneratorService::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale');
111 111
         }
112 112
     }
113 113
 }
114 114
\ No newline at end of file
Please login to merge, or discard this patch.