Passed
Push — master ( 24b168...a960f8 )
by Fran
03:28
created
src/base/Security.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $saved = true;
124 124
         try {
125
-            $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true) ?: [];
126
-            $admins[$user['username']]['hash'] = sha1($user['username'] . $user['password']);
125
+            $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true) ?: [];
126
+            $admins[$user['username']]['hash'] = sha1($user['username'].$user['password']);
127 127
             $admins[$user['username']]['profile'] = $user['profile'];
128 128
 
129
-            Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', $admins, Cache::JSONGZ, true);
130
-        } catch(\Exception $e) {
129
+            Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', $admins, Cache::JSONGZ, true);
130
+        }catch (\Exception $e) {
131 131
             Logger::log($e->getMessage(), LOG_ERR);
132 132
             $saved = false;
133 133
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public function getAdmins()
166 166
     {
167
-        return Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true);
167
+        return Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true);
168 168
     }
169 169
 
170 170
     /**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                 }
192 192
                 if (!empty($user) && !empty($admins[$user])) {
193 193
                     $auth = $admins[$user]['hash'];
194
-                    $this->authorized = ($auth == sha1($user . $pass));
194
+                    $this->authorized = ($auth == sha1($user.$pass));
195 195
                     if ($this->authorized) {
196 196
                         $this->admin = array(
197 197
                             'alias' => $user,
Please login to merge, or discard this patch.
src/base/types/helpers/SecurityHelper.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         if (!Config::getInstance()->checkTryToSaveConfig()
30 30
             && (preg_match('/^\/(admin|setup\-admin)/i', $route) || NULL !== Config::getInstance()->get('restricted'))
31 31
         ) {
32
-            if (null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) {
32
+            if (null === Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true)) {
33 33
                 throw new AdminCredentialsException();
34 34
             }
35 35
             if (!Security::getInstance()->checkAdmin()) {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
         $token = '';
50 50
         $ct = strlen($ts);
51 51
         for ($i = 0; $i < $ct; $i++) {
52
-            $token = substr($hash, $i, 1) .
53
-                    substr($ts, $i, 1) .
52
+            $token = substr($hash, $i, 1).
53
+                    substr($ts, $i, 1).
54 54
                     $token;
55 55
         }
56 56
         return $token;
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
         $charsLength = strlen(self::RAND_SEP) - 1;
69 69
         $tsLength = strlen($ts);
70 70
         $i = 0;
71
-        $ct = ceil($hashRest / 4);
72
-        $part = substr($hash, $tsLength + $ct * $i, $ct);
73
-        while(false !== $part) {
74
-            $mixedToken .= $part .
75
-                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1) .
71
+        $ct = ceil($hashRest/4);
72
+        $part = substr($hash, $tsLength + $ct*$i, $ct);
73
+        while (false !== $part) {
74
+            $mixedToken .= $part.
75
+                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1).
76 76
                 substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1);
77
-            $part = substr($hash, $tsLength + $ct * $i, $ct);
77
+            $part = substr($hash, $tsLength + $ct*$i, $ct);
78 78
             $i++;
79 79
         }
80
-        return $mixedToken . $token;
80
+        return $mixedToken.$token;
81 81
     }
82 82
 
83 83
     /**
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private static function getTs($isOdd = null) {
88 88
         $ts = time();
89
-        $tsIsOdd = (bool)((int)substr($ts, -1) % 2);
90
-        if(false === $isOdd && !$tsIsOdd) {
89
+        $tsIsOdd = (bool)((int)substr($ts, -1)%2);
90
+        if (false === $isOdd && !$tsIsOdd) {
91 91
             $ts--;
92
-        } elseif(true === $isOdd && !$tsIsOdd) {
92
+        } elseif (true === $isOdd && !$tsIsOdd) {
93 93
             $ts--;
94 94
         }
95 95
         return $ts;
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
         $partToken = '';
122 122
         $ts = '';
123 123
         $part = strrev($part);
124
-        for($i = 0, $ct = strlen($part); $i < $ct; $i++) {
125
-            if($i % 2 == 0) {
124
+        for ($i = 0, $ct = strlen($part); $i < $ct; $i++) {
125
+            if ($i%2 == 0) {
126 126
                 $ts .= substr($part, $i, 1);
127
-            } else {
127
+            }else {
128 128
                 $partToken .= substr($part, $i, 1);
129 129
             }
130 130
         }
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
     private static function parseTokenParts(array $parts) {
140 140
         $token = '';
141 141
         list($partToken, $ts) = self::extractTs(array_pop($parts));
142
-        if($ts > 0) {
143
-            foreach($parts as $part) {
142
+        if ($ts > 0) {
143
+            foreach ($parts as $part) {
144 144
                 $token .= $part;
145 145
             }
146
-            $token = $partToken . $token;
146
+            $token = $partToken.$token;
147 147
         }
148 148
         return [$token, $ts];
149 149
     }
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
      * @return array
172 172
      */
173 173
     private static function extractTokenParts($token) {
174
-        for($i = 0, $ct = strlen(self::RAND_SEP); $i < $ct; $i++) {
175
-            $token = str_replace(substr(self::RAND_SEP,$i,1), "|", $token);
174
+        for ($i = 0, $ct = strlen(self::RAND_SEP); $i < $ct; $i++) {
175
+            $token = str_replace(substr(self::RAND_SEP, $i, 1), "|", $token);
176 176
         }
177 177
         return array_unique(explode('||', $token));
178 178
     }
Please login to merge, or discard this patch.
src/base/extension/AssetsParser.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     public function __construct($type = 'js')
33 33
     {
34 34
         $this->type = $type;
35
-        $this->path = WEB_DIR . DIRECTORY_SEPARATOR;
35
+        $this->path = WEB_DIR.DIRECTORY_SEPARATOR;
36 36
         $this->domains = Template::getDomains(true);
37 37
         $this->debug = Config::getInstance()->getDebugMode();
38 38
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             $source_file = explode("?", $source_file);
55 55
             $source_file = $source_file[0];
56 56
         }
57
-        $orig = realpath(dirname($filename_path) . DIRECTORY_SEPARATOR . $source_file);
57
+        $orig = realpath(dirname($filename_path).DIRECTORY_SEPARATOR.$source_file);
58 58
         return $orig;
59 59
     }
60 60
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function addFile($filename)
69 69
     {
70
-        if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) {
70
+        if (file_exists($this->path.$filename) && preg_match('/\.'.$this->type.'$/i', $filename)) {
71 71
             $this->files[] = $filename;
72 72
         } elseif (!empty($this->domains)) {
73 73
             foreach ($this->domains as $domain => $paths) {
74 74
                 $domain_filename = str_replace($domain, $paths["public"], $filename);
75
-                if (file_exists($domain_filename) && preg_match('/\.' . $this->type . '$/i', $domain_filename)) {
75
+                if (file_exists($domain_filename) && preg_match('/\.'.$this->type.'$/i', $domain_filename)) {
76 76
                     $this->files[] = $domain_filename;
77 77
                 }
78 78
             }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     public function setHash($hash)
90 90
     {
91 91
         $cache = Config::getParam('cache.var', '');
92
-        $this->hash = $hash . (strlen($cache) ? '.' : '') . $cache;
92
+        $this->hash = $hash.(strlen($cache) ? '.' : '').$cache;
93 93
         return $this;
94 94
     }
95 95
 
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
      */
124 124
     protected function compileCss()
125 125
     {
126
-        $base = $this->path . "css" . DIRECTORY_SEPARATOR;
127
-        if ($this->debug || !file_exists($base . $this->hash . ".css")) {
126
+        $base = $this->path."css".DIRECTORY_SEPARATOR;
127
+        if ($this->debug || !file_exists($base.$this->hash.".css")) {
128 128
             $data = '';
129 129
             if (0 < count($this->files)) {
130 130
                 foreach ($this->files as $file) {
131 131
                     $data = $this->processCssLine($file, $base, $data);
132 132
                 }
133 133
             }
134
-            $this->storeContents($base . $this->hash . ".css", \CssMin::minify($data));
134
+            $this->storeContents($base.$this->hash.".css", \CssMin::minify($data));
135 135
             unset($cssMinifier);
136 136
         }
137 137
         return $this;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
      */
145 145
     protected function compileJs()
146 146
     {
147
-        $base = $this->path . "js" . DIRECTORY_SEPARATOR;
148
-        if ($this->debug || !file_exists($base . $this->hash . ".js")) {
147
+        $base = $this->path."js".DIRECTORY_SEPARATOR;
148
+        if ($this->debug || !file_exists($base.$this->hash.".js")) {
149 149
             $data = '';
150 150
             if (0 < count($this->files)) {
151 151
                 foreach ($this->files as $file) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                     if (file_exists($file)) {
154 154
                         if ($this->debug) {
155 155
                             $data = $this->putDebugJs($path_parts, $base, $file);
156
-                        } elseif (!file_exists($base . $this->hash . ".js")) {
156
+                        } elseif (!file_exists($base.$this->hash.".js")) {
157 157
                             $data = $this->putProductionJs($base, $file, $data);
158 158
                         }
159 159
                     }
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
             }
162 162
             try {
163 163
                 $minifiedJs = Minifier::minify($data);
164
-            } catch (\Exception $e) {
164
+            }catch (\Exception $e) {
165 165
                 Logger::log($e->getMessage(), LOG_ERR);
166 166
                 $minifiedJs = false;
167 167
             }
168
-            $this->storeContents($base . $this->hash . ".js", (false !== $minifiedJs) ? $minifiedJs : $data);
168
+            $this->storeContents($base.$this->hash.".js", (false !== $minifiedJs) ? $minifiedJs : $data);
169 169
         }
170 170
         return $this;
171 171
     }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     {
181 181
         GeneratorHelper::createDir(dirname($path));
182 182
         if ("" !== $content && false === file_put_contents($path, $content)) {
183
-            throw new ConfigException(_('No se tienen permisos para escribir en ' . $path));
183
+            throw new ConfigException(_('No se tienen permisos para escribir en '.$path));
184 184
         }
185 185
     }
186 186
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
             foreach ($this->compiled_files as $file) {
210 210
                 echo "\t\t<script type='text/javascript' src='{$file}'></script>\n";
211 211
             }
212
-        } else {
213
-            echo "\t\t<script type='text/javascript' src='/js/" . $this->hash . ".js'></script>\n";
212
+        }else {
213
+            echo "\t\t<script type='text/javascript' src='/js/".$this->hash.".js'></script>\n";
214 214
         }
215 215
     }
216 216
 
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
             foreach ($this->compiled_files as $file) {
224 224
                 echo "\t\t<link href='{$file}' rel='stylesheet' media='screen, print'>";
225 225
             }
226
-        } else {
227
-            echo "\t\t<link href='/css/" . $this->hash . ".css' rel='stylesheet'>";
226
+        }else {
227
+            echo "\t\t<link href='/css/".$this->hash.".css' rel='stylesheet'>";
228 228
         }
229 229
     }
230 230
 
@@ -235,20 +235,20 @@  discard block
 block discarded – undo
235 235
     protected function extractCssResources($source, $file)
236 236
     {
237 237
         $source_file = $this->extractSourceFilename($source);
238
-        $orig = realpath(dirname($file) . DIRECTORY_SEPARATOR . $source_file);
238
+        $orig = realpath(dirname($file).DIRECTORY_SEPARATOR.$source_file);
239 239
         $orig_part = preg_split('/(\/|\\\)public(\/|\\\)/i', $orig);
240 240
         try {
241 241
             if (count($source) > 1 && array_key_exists(1, $orig_part)) {
242
-                $dest = $this->path . $orig_part[1];
242
+                $dest = $this->path.$orig_part[1];
243 243
                 GeneratorHelper::createDir(dirname($dest));
244 244
                 if (!file_exists($dest) || filemtime($orig) > filemtime($dest)) {
245 245
                     if (@copy($orig, $dest) === FALSE) {
246
-                        throw new \RuntimeException('Can\' copy ' . $dest . '');
246
+                        throw new \RuntimeException('Can\' copy '.$dest.'');
247 247
                     }
248 248
                     Logger::log("$orig copiado a $dest", LOG_INFO);
249 249
                 }
250 250
             }
251
-        } catch (\Exception $e) {
251
+        }catch (\Exception $e) {
252 252
             Logger::log($e->getMessage(), LOG_ERR);
253 253
         }
254 254
     }
@@ -265,21 +265,21 @@  discard block
 block discarded – undo
265 265
     {
266 266
         if (file_exists($file)) {
267 267
             $path_parts = explode("/", $file);
268
-            $file_path = $this->hash . "_" . $path_parts[count($path_parts) - 1];
269
-            if (!file_exists($base . $file_path) || filemtime($base . $file_path) < filemtime($file) || $this->debug) {
268
+            $file_path = $this->hash."_".$path_parts[count($path_parts) - 1];
269
+            if (!file_exists($base.$file_path) || filemtime($base.$file_path) < filemtime($file) || $this->debug) {
270 270
                 //Si tenemos modificaciones tenemos que compilar de nuevo todos los ficheros modificados
271
-                if (file_exists($base . $this->hash . ".css") && @unlink($base . $this->hash . ".css") === false) {
272
-                    throw new ConfigException("Can't unlink file " . $base . $this->hash . ".css");
271
+                if (file_exists($base.$this->hash.".css") && @unlink($base.$this->hash.".css") === false) {
272
+                    throw new ConfigException("Can't unlink file ".$base.$this->hash.".css");
273 273
                 }
274 274
                 $this->loopCssLines($file);
275 275
             }
276 276
             if ($this->debug) {
277 277
                 $data = file_get_contents($file);
278
-                $this->storeContents($base . $file_path, $data);
279
-            } else {
278
+                $this->storeContents($base.$file_path, $data);
279
+            }else {
280 280
                 $data .= file_get_contents($file);
281 281
             }
282
-            $this->compiled_files[] = "/css/" . $file_path;
282
+            $this->compiled_files[] = "/css/".$file_path;
283 283
         }
284 284
 
285 285
         return $data;
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
      */
295 295
     protected function putDebugJs($path_parts, $base, $file)
296 296
     {
297
-        $file_path = $this->hash . "_" . $path_parts[count($path_parts) - 1];
298
-        $this->compiled_files[] = "/js/" . $file_path;
297
+        $file_path = $this->hash."_".$path_parts[count($path_parts) - 1];
298
+        $this->compiled_files[] = "/js/".$file_path;
299 299
         $data = "";
300
-        if (!file_exists($base . $file_path) || filemtime($base . $file_path) < filemtime($file)) {
300
+        if (!file_exists($base.$file_path) || filemtime($base.$file_path) < filemtime($file)) {
301 301
             $data = file_get_contents($file);
302
-            $this->storeContents($base . $file_path, $data);
302
+            $this->storeContents($base.$file_path, $data);
303 303
         }
304 304
         return $data;
305 305
     }
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
     {
317 317
         $js = file_get_contents($file);
318 318
         try {
319
-            $data .= ";\n" . $js;
320
-        } catch (\Exception $e) {
319
+            $data .= ";\n".$js;
320
+        }catch (\Exception $e) {
321 321
             throw new ConfigException($e->getMessage());
322 322
         }
323 323
         return $data;
@@ -360,53 +360,53 @@  discard block
 block discarded – undo
360 360
     {
361 361
         $ppath = explode("/", $string);
362 362
         $original_filename = $ppath[count($ppath) - 1];
363
-        $base = WEB_DIR . DIRECTORY_SEPARATOR;
363
+        $base = WEB_DIR.DIRECTORY_SEPARATOR;
364 364
         $file = "";
365 365
         $html_base = "";
366 366
         $debug = Config::getInstance()->getDebugMode();
367 367
         $cache = Config::getInstance()->get('cache.var');
368
-        $cache = $cache ? '.' . $cache : '';
368
+        $cache = $cache ? '.'.$cache : '';
369 369
         $finfo = finfo_open(FILEINFO_MIME_TYPE); // devuelve el tipo mime de su extensión
370 370
         $mime = finfo_file($finfo, $filename_path);
371 371
         finfo_close($finfo);
372 372
         if (preg_match('/\.css$/i', $string)) {
373
-            $file = "/" . substr(md5($string), 0, 8) . "$cache.css";
373
+            $file = "/".substr(md5($string), 0, 8)."$cache.css";
374 374
             $html_base = "css";
375 375
             if ($debug) {
376
-                $file = str_replace(".css", "_" . $original_filename, $file);
376
+                $file = str_replace(".css", "_".$original_filename, $file);
377 377
             }
378 378
         } elseif (preg_match('/\.js$/i', $string)) {
379
-            $file = "/" . substr(md5($string), 0, 8) . "$cache.js";
379
+            $file = "/".substr(md5($string), 0, 8)."$cache.js";
380 380
             $html_base = "js";
381 381
             if ($debug) {
382
-                $file = str_replace(".js", "_" . $original_filename, $file);
382
+                $file = str_replace(".js", "_".$original_filename, $file);
383 383
             }
384 384
         } elseif (preg_match("/image/i", $mime)) {
385 385
             $ext = explode(".", $string);
386
-            $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1];
386
+            $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1];
387 387
             $html_base = "img";
388 388
             if ($debug) {
389
-                $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file);
389
+                $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file);
390 390
             }
391 391
         } elseif (preg_match("/(doc|pdf)/i", $mime)) {
392 392
             $ext = explode(".", $string);
393
-            $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1];
393
+            $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1];
394 394
             $html_base = "docs";
395 395
             if ($debug) {
396
-                $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file);
396
+                $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file);
397 397
             }
398 398
         } elseif (preg_match("/(video|audio|ogg)/i", $mime)) {
399 399
             $ext = explode(".", $string);
400
-            $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1];
400
+            $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1];
401 401
             $html_base = "media";
402 402
             if ($debug) {
403
-                $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file);
403
+                $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file);
404 404
             }
405 405
         } elseif (!$return && !is_null($name)) {
406 406
             $html_base = '';
407 407
             $file = $name;
408 408
         }
409
-        $file_path = $html_base . $file;
409
+        $file_path = $html_base.$file;
410 410
 
411 411
         return array($base, $html_base, $file_path);
412 412
     }
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
             foreach ($urls as $source) {
426 426
                 $orig = self::calculateResourcePathname($filename_path, $source);
427 427
                 $orig_part = explode("Public", $orig);
428
-                $dest = WEB_DIR . $orig_part[1];
428
+                $dest = WEB_DIR.$orig_part[1];
429 429
                 GeneratorHelper::createDir(dirname($dest));
430 430
                 if (@copy($orig, $dest) === false) {
431
-                    throw new ConfigException("Can't copy " . $orig . " to " . $dest);
431
+                    throw new ConfigException("Can't copy ".$orig." to ".$dest);
432 432
                 }
433 433
             }
434 434
         }
Please login to merge, or discard this patch.
src/base/types/SingletonTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace PSFS\base\types;
4 4
 
5
-require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php';
5
+require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php';
6 6
 /**
7 7
  * Class SingletonTrait
8 8
  * @package PSFS\base\types
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
@@ -5,17 +5,17 @@
 block discarded – undo
5 5
 
6 6
 if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__);
7 7
 if (preg_match('/vendor/', SOURCE_DIR)) {
8
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
9
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
10
-} else {
11
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
12
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
8
+    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..');
9
+    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src');
10
+}else {
11
+    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..');
12
+    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules');
13 13
 }
14
-if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor');
15
-if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
16
-if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
17
-if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
18
-if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
14
+if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor');
15
+if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
16
+if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache');
17
+if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config');
18
+if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html');
19 19
 
20 20
 defined('PSFS_BOOTSTRAP_LOADED') or define('PSFS_BOOTSTRAP_LOADED', true);
21 21
 
Please login to merge, or discard this patch.
Braces   +35 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,21 +1,43 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace PSFS;
3 3
 
4
-if (defined('PSFS_BOOTSTRAP_LOADED')) return;
4
+if (defined('PSFS_BOOTSTRAP_LOADED')) {
5
+    return;
6
+}
5 7
 
6
-if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__);
8
+if (!defined('SOURCE_DIR')) {
9
+    define('SOURCE_DIR', __DIR__);
10
+}
7 11
 if (preg_match('/vendor/', SOURCE_DIR)) {
8
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
9
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
10
-} else {
11
-    if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
12
-    if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
13
-}
14
-if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor');
15
-if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
16
-if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
17
-if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
18
-if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
12
+    if (!defined('BASE_DIR')) {
13
+        define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
14
+    }
15
+    if (!defined('CORE_DIR')) {
16
+        define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src');
17
+    }
18
+    } else {
19
+    if (!defined('BASE_DIR')) {
20
+        define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..');
21
+    }
22
+    if (!defined('CORE_DIR')) {
23
+        define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules');
24
+    }
25
+    }
26
+if (!defined('VENDOR_DIR')) {
27
+    define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor');
28
+}
29
+if (!defined('LOG_DIR')) {
30
+    define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
31
+}
32
+if (!defined('CACHE_DIR')) {
33
+    define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache');
34
+}
35
+if (!defined('CONFIG_DIR')) {
36
+    define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config');
37
+}
38
+if (!defined('WEB_DIR')) {
39
+    define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html');
40
+}
19 41
 
20 42
 defined('PSFS_BOOTSTRAP_LOADED') or define('PSFS_BOOTSTRAP_LOADED', true);
21 43
 
Please login to merge, or discard this patch.
src/services/GeneratorService.php 2 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     /**
28 28
      * Método que revisa las traducciones directorio a directorio
29
-     * @param $path
29
+     * @param string $path
30 30
      * @param $locale
31 31
      * @return array
32 32
      */
@@ -85,7 +85,6 @@  discard block
 block discarded – undo
85 85
      * Service that creates the root paths for the modules
86 86
      * @param string $module
87 87
      * @param string $mod_path
88
-     * @param boolean $isModule
89 88
      */
90 89
     private function createModulePath($module, $mod_path)
91 90
     {
@@ -99,7 +98,7 @@  discard block
 block discarded – undo
99 98
      * Servicio que genera la estructura base
100 99
      * @param string $module
101 100
      * @param boolean $mod_path
102
-     * @return boolean
101
+     * @return boolean|null
103 102
      */
104 103
     private function createModulePathTree($module, $mod_path)
105 104
     {
@@ -464,7 +463,7 @@  discard block
 block discarded – undo
464 463
      * Method that copy resources recursively
465 464
      * @param string $dest
466 465
      * @param boolean $force
467
-     * @param $filename_path
466
+     * @param string $filename_path
468 467
      * @param boolean $debug
469 468
      */
470 469
     public static function copyResources($dest, $force, $filename_path, $debug)
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -32,24 +32,24 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function findTranslations($path, $locale)
34 34
     {
35
-        $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale');
36
-        $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR;
35
+        $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale');
36
+        $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR;
37 37
 
38 38
         $translations = array();
39 39
         if (file_exists($path)) {
40 40
             $d = dir($path);
41 41
             while (false !== ($dir = $d->read())) {
42 42
                 GeneratorHelper::createDir($locale_path);
43
-                if (!file_exists($locale_path . 'translations.po')) {
44
-                    file_put_contents($locale_path . 'translations.po', '');
43
+                if (!file_exists($locale_path.'translations.po')) {
44
+                    file_put_contents($locale_path.'translations.po', '');
45 45
                 }
46
-                $inspect_path = realpath($path . DIRECTORY_SEPARATOR . $dir);
47
-                $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext " .
48
-                    $inspect_path . DIRECTORY_SEPARATOR .
46
+                $inspect_path = realpath($path.DIRECTORY_SEPARATOR.$dir);
47
+                $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ".
48
+                    $inspect_path.DIRECTORY_SEPARATOR.
49 49
                     "*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po";
50
-                if (is_dir($path . DIRECTORY_SEPARATOR . $dir) && preg_match('/^\./', $dir) == 0) {
51
-                    $res = _('Revisando directorio: ') . $inspect_path;
52
-                    $res .= _('Comando ejecutado: ') . $cmd_php;
50
+                if (is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./', $dir) == 0) {
51
+                    $res = _('Revisando directorio: ').$inspect_path;
52
+                    $res .= _('Comando ejecutado: ').$cmd_php;
53 53
                     $res .= shell_exec($cmd_php);
54 54
                     usleep(10);
55 55
                     $translations[] = $res;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function createStructureModule($module, $force = false, $type = "", $apiClass = "")
72 72
     {
73
-        $mod_path = CORE_DIR . DIRECTORY_SEPARATOR;
73
+        $mod_path = CORE_DIR.DIRECTORY_SEPARATOR;
74 74
         $module = ucfirst($module);
75 75
         $this->createModulePath($module, $mod_path);
76 76
         $this->createModulePathTree($module, $mod_path);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         // Creates the src folder
93 93
         GeneratorHelper::createDir($mod_path);
94 94
         // Create module path
95
-        GeneratorHelper::createDir($mod_path . $module);
95
+        GeneratorHelper::createDir($mod_path.$module);
96 96
     }
97 97
 
98 98
     /**
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
         $paths = [
109 109
             "Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test"
110 110
         ];
111
-        $module_path = $mod_path . $module;
111
+        $module_path = $mod_path.$module;
112 112
         foreach ($paths as $path) {
113
-            GeneratorHelper::createDir($module_path . DIRECTORY_SEPARATOR . $path);
113
+            GeneratorHelper::createDir($module_path.DIRECTORY_SEPARATOR.$path);
114 114
         }
115 115
         //Creamos las carpetas de los assets
116 116
         $htmlPaths = array("css", "js", "img", "media", "font");
117 117
         foreach ($htmlPaths as $path) {
118
-            GeneratorHelper::createDir($module_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path);
118
+            GeneratorHelper::createDir($module_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path);
119 119
         }
120 120
     }
121 121
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '')
130 130
     {
131
-        $module_path = $mod_path . $module;
131
+        $module_path = $mod_path.$module;
132 132
         $this->generateControllerTemplate($module, $module_path, $force, $controllerType);
133 133
         $this->generateServiceTemplate($module, $module_path, $force);
134 134
         $this->genereateAutoloaderTemplate($module, $module_path, $force);
@@ -146,28 +146,28 @@  discard block
 block discarded – undo
146 146
      */
147 147
     private function createModuleModels($module, $path)
148 148
     {
149
-        $module_path = $path . $module;
150
-        $module_path = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $module_path);
149
+        $module_path = $path.$module;
150
+        $module_path = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $module_path);
151 151
         //Generamos las clases de propel y la configuración
152
-        $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR .
153
-            "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel ";
154
-        $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path .
155
-            DIRECTORY_SEPARATOR . "Config";
156
-        $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR .
157
-            "Config --output-dir=" . CORE_DIR . " --verbose";
158
-        $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n" . $exec . "build" . $opt . $schemaOpt);
159
-        $ret = shell_exec($exec . "build" . $opt . $schemaOpt);
152
+        $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR.
153
+            "vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel ";
154
+        $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.
155
+            DIRECTORY_SEPARATOR."Config";
156
+        $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR.
157
+            "Config --output-dir=".CORE_DIR." --verbose";
158
+        $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n".$exec."build".$opt.$schemaOpt);
159
+        $ret = shell_exec($exec."build".$opt.$schemaOpt);
160 160
 
161 161
         $this->log->infoLog("[GENERATOR] Generamos clases invocando a propel:\n $ret");
162
-        $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR .
163
-            $module_path . DIRECTORY_SEPARATOR . "Config" . $schemaOpt);
162
+        $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.
163
+            $module_path.DIRECTORY_SEPARATOR."Config".$schemaOpt);
164 164
         $this->log->infoLog("[GENERATOR] Generamos sql invocando a propel:\n $ret");
165 165
 
166 166
         $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array(
167 167
             "module" => $module,
168 168
         ));
169
-        $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . "Config" .
170
-            DIRECTORY_SEPARATOR . "config.php", true);
169
+        $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR."Config".
170
+            DIRECTORY_SEPARATOR."config.php", true);
171 171
         $this->log->infoLog("Generado config genérico para propel:\n $ret");
172 172
     }
173 173
 
@@ -188,32 +188,32 @@  discard block
 block discarded – undo
188 188
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
189 189
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
190 190
             "class" => $class,
191
-            "controllerType" => $class . "Base",
191
+            "controllerType" => $class."Base",
192 192
             "is_base" => false
193 193
         ));
194
-        $controller = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" .
195
-            DIRECTORY_SEPARATOR . "{$class}Controller.php", $force);
194
+        $controller = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller".
195
+            DIRECTORY_SEPARATOR."{$class}Controller.php", $force);
196 196
 
197 197
         $controllerBody = $this->tpl->dump("generator/controller.template.twig", array(
198 198
             "module" => $module,
199 199
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
200 200
             "url" => preg_replace('/(\\\|\/)/', '/', $module),
201
-            "class" => $class . "Base",
201
+            "class" => $class."Base",
202 202
             "service" => $class,
203 203
             "controllerType" => $controllerType,
204 204
             "is_base" => true,
205 205
             "domain" => $class,
206 206
         ));
207
-        $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" .
208
-            DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true);
207
+        $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller".
208
+            DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true);
209 209
 
210 210
         $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array(
211 211
             "module" => $module,
212 212
             "namespace" => preg_replace('/(\\\|\/)/', '\\', $module),
213 213
             "class" => $class,
214 214
         ));
215
-        $test = $this->writeTemplateToFile($testTemplate, $mod_path . DIRECTORY_SEPARATOR . "Test" .
216
-            DIRECTORY_SEPARATOR . "{$class}Test.php", true);
215
+        $test = $this->writeTemplateToFile($testTemplate, $mod_path.DIRECTORY_SEPARATOR."Test".
216
+            DIRECTORY_SEPARATOR."{$class}Test.php", true);
217 217
         return ($controller && $controllerBase && $test);
218 218
     }
219 219
 
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
     private function generateBaseApiTemplate($module, $mod_path, $force = false, $apiClass = "")
228 228
     {
229 229
         $created = true;
230
-        $modelPath = $mod_path . $module . DIRECTORY_SEPARATOR . 'Models';
231
-        $api_path = $mod_path . $module . DIRECTORY_SEPARATOR . 'Api';
230
+        $modelPath = $mod_path.$module.DIRECTORY_SEPARATOR.'Models';
231
+        $api_path = $mod_path.$module.DIRECTORY_SEPARATOR.'Api';
232 232
         if (file_exists($modelPath)) {
233 233
             $dir = dir($modelPath);
234 234
             while ($file = $dir->read()) {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         //Generamos el fichero de configuración
257 257
         $this->log->infoLog("Generamos fichero vacío de configuración");
258 258
         return $this->writeTemplateToFile("<?php\n\t",
259
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php",
259
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php",
260 260
             $force);
261 261
     }
262 262
 
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
         //Generamos el fichero de configuración
272 272
         $this->log->infoLog("Generamos ficheros para assets base");
273 273
         $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n",
274
-            $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css",
274
+            $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css",
275 275
             $force);
276 276
         $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();",
277
-            $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js",
277
+            $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js",
278 278
             $force);
279 279
         return ($css && $js);
280 280
     }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             "class" => $class,
297 297
         ));
298 298
         return $this->writeTemplateToFile($controller,
299
-            $mod_path . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$class}Service.php",
299
+            $mod_path.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$class}Service.php",
300 300
             $force);
301 301
     }
302 302
 
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
             "autoloader" => preg_replace('/(\\\|\/)/', '_', $module),
316 316
             "regex" => preg_replace('/(\\\|\/)/m', '\\\\\\\\\\\\', $module),
317 317
         ));
318
-        $autoload = $this->writeTemplateToFile($autoloader, $mod_path . DIRECTORY_SEPARATOR . "autoload.php", $force);
318
+        $autoload = $this->writeTemplateToFile($autoloader, $mod_path.DIRECTORY_SEPARATOR."autoload.php", $force);
319 319
 
320 320
         $this->log->infoLog("Generamos el phpunit");
321 321
         $phpUnitTemplate = $this->tpl->dump("generator/phpunit.template.twig", array(
322 322
             "module" => $module,
323 323
         ));
324
-        $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path . DIRECTORY_SEPARATOR . "phpunit.xml.dist", $force);
324
+        $phpunit = $this->writeTemplateToFile($phpUnitTemplate, $mod_path.DIRECTORY_SEPARATOR."phpunit.xml.dist", $force);
325 325
         return $autoload && $phpunit;
326 326
     }
327 327
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             "db" => $this->config->get("db_name"),
343 343
         ));
344 344
         return $this->writeTemplateToFile($schema,
345
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml",
345
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml",
346 346
             $force);
347 347
     }
348 348
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             "namespace" => preg_replace('/(\\\|\/)/', '', $module),
366 366
         ));
367 367
         return $this->writeTemplateToFile($build_properties,
368
-            $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml",
368
+            $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml",
369 369
             $force);
370 370
     }
371 371
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             "module" => $module,
384 384
         ));
385 385
         return $this->writeTemplateToFile($index,
386
-            $mod_path . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig",
386
+            $mod_path.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig",
387 387
             $force);
388 388
     }
389 389
 
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
             try {
402 402
                 $this->cache->storeData($filename, $fileContent, Cache::TEXT, true);
403 403
                 $created = true;
404
-            } catch (\Exception $e) {
404
+            }catch (\Exception $e) {
405 405
                 $this->log->errorLog($e->getMessage());
406 406
             }
407
-        } else {
408
-            $this->log->errorLog($filename . _(' not exists or cant write'));
407
+        }else {
408
+            $this->log->errorLog($filename._(' not exists or cant write'));
409 409
         }
410 410
         return $created;
411 411
     }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         ));
435 435
 
436 436
         return $this->writeTemplateToFile($controller,
437
-            $mod_path . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true);
437
+            $mod_path.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true);
438 438
     }
439 439
 
440 440
     /**
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             "class" => $class,
458 458
         ));
459 459
 
460
-        return $this->writeTemplateToFile($controller, $mod_path . DIRECTORY_SEPARATOR . "{$api}.php", $force);
460
+        return $this->writeTemplateToFile($controller, $mod_path.DIRECTORY_SEPARATOR."{$api}.php", $force);
461 461
     }
462 462
 
463 463
     /**
@@ -471,12 +471,12 @@  discard block
 block discarded – undo
471 471
     {
472 472
         if (file_exists($filename_path)) {
473 473
             $destfolder = basename($filename_path);
474
-            if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) {
474
+            if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) {
475 475
                 if (is_dir($filename_path)) {
476
-                    self::copyr($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
477
-                } else {
478
-                    if (@copy($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) {
479
-                        throw new ConfigException("Can't copy " . $filename_path . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder);
476
+                    self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
477
+                }else {
478
+                    if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) {
479
+                        throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder);
480 480
                     }
481 481
                 }
482 482
             }
@@ -495,10 +495,10 @@  discard block
 block discarded – undo
495 495
         GeneratorHelper::createDir($dst);
496 496
         while (false !== ($file = readdir($dir))) {
497 497
             if (($file != '.') && ($file != '..')) {
498
-                if (is_dir($src . '/' . $file)) {
499
-                    self::copyr($src . '/' . $file, $dst . '/' . $file);
500
-                } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) {
501
-                    throw new ConfigException("Can't copy " . $src . " to " . $dst);
498
+                if (is_dir($src.'/'.$file)) {
499
+                    self::copyr($src.'/'.$file, $dst.'/'.$file);
500
+                } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) {
501
+                    throw new ConfigException("Can't copy ".$src." to ".$dst);
502 502
                 }
503 503
             }
504 504
         }
Please login to merge, or discard this patch.
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.