@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | new InputArgument('path', InputArgument::OPTIONAL, 'Path en el que crear el Document Root'), |
14 | 14 | )) |
15 | 15 | ->setDescription('Comando de creación del Document Root del projecto') |
16 | - ->setCode(function (InputInterface $input, OutputInterface $output) { |
|
16 | + ->setCode(function(InputInterface $input, OutputInterface $output) { |
|
17 | 17 | // Creates the html path |
18 | 18 | $path = $input->getArgument('path'); |
19 | 19 | if (empty($path)) $path = WEB_DIR; |
20 | 20 | \PSFS\base\types\helpers\GeneratorHelper::createDir($path); |
21 | 21 | $paths = array("js", "css", "img", "media", "font"); |
22 | 22 | foreach ($paths as $htmlPath) { |
23 | - \PSFS\base\types\helpers\GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath); |
|
23 | + \PSFS\base\types\helpers\GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | // Generates the root needed files |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | 'robots' => 'robots.txt', |
33 | 33 | ]; |
34 | 34 | foreach ($files as $templates => $filename) { |
35 | - $text = \PSFS\base\Template::getInstance()->dump("generator/html/" . $templates . '.html.twig'); |
|
36 | - if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) { |
|
37 | - $output->writeln('Can\t create the file ' . $filename); |
|
38 | - } else { |
|
39 | - $output->writeln($filename . ' created successfully'); |
|
35 | + $text = \PSFS\base\Template::getInstance()->dump("generator/html/".$templates.'.html.twig'); |
|
36 | + if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) { |
|
37 | + $output->writeln('Can\t create the file '.$filename); |
|
38 | + }else { |
|
39 | + $output->writeln($filename.' created successfully'); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | 43 | //Export base locale translations |
44 | - if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) { |
|
45 | - \PSFS\base\types\helpers\GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
46 | - \PSFS\Services\GeneratorService::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
44 | + if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
45 | + \PSFS\base\types\helpers\GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
46 | + \PSFS\Services\GeneratorService::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
47 | 47 | } |
48 | 48 | |
49 | - $output->writeln("Document root generado en " . $path); |
|
49 | + $output->writeln("Document root generado en ".$path); |
|
50 | 50 | }); |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | use Symfony\Component\Console\Input\InputInterface; |
7 | 7 | use Symfony\Component\Console\Output\OutputInterface; |
8 | 8 | |
9 | -if (!isset($console)) $console = new Application(); |
|
9 | +if (!isset($console)) { |
|
10 | + $console = new Application(); |
|
11 | +} |
|
10 | 12 | $console |
11 | 13 | ->register('psfs:create:root') |
12 | 14 | ->setDefinition(array( |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | ->setCode(function (InputInterface $input, OutputInterface $output) { |
17 | 19 | // Creates the html path |
18 | 20 | $path = $input->getArgument('path'); |
19 | - if (empty($path)) $path = WEB_DIR; |
|
21 | + if (empty($path)) { |
|
22 | + $path = WEB_DIR; |
|
23 | + } |
|
20 | 24 | \PSFS\base\types\helpers\GeneratorHelper::createDir($path); |
21 | 25 | $paths = array("js", "css", "img", "media", "font"); |
22 | 26 | foreach ($paths as $htmlPath) { |
@@ -11,20 +11,20 @@ discard block |
||
11 | 11 | */ |
12 | 12 | // Load custom config |
13 | 13 | $pwd = getcwd(); |
14 | -$dir = $pwd . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR; |
|
14 | +$dir = $pwd.DIRECTORY_SEPARATOR."vendor".DIRECTORY_SEPARATOR; |
|
15 | 15 | |
16 | -require_once $dir . 'autoload.php'; |
|
16 | +require_once $dir.'autoload.php'; |
|
17 | 17 | |
18 | 18 | |
19 | -$project_path = $pwd . DIRECTORY_SEPARATOR . "src" . DIRECTORY_SEPARATOR; |
|
20 | -if (file_exists($project_path . "bootstrap.php")) { |
|
21 | - include_once($project_path . "bootstrap.php"); |
|
19 | +$project_path = $pwd.DIRECTORY_SEPARATOR."src".DIRECTORY_SEPARATOR; |
|
20 | +if (file_exists($project_path."bootstrap.php")) { |
|
21 | + include_once($project_path."bootstrap.php"); |
|
22 | 22 | } |
23 | -if (file_exists($project_path . "autoload.php")) { |
|
24 | - include_once($project_path . "autoload.php"); |
|
23 | +if (file_exists($project_path."autoload.php")) { |
|
24 | + include_once($project_path."autoload.php"); |
|
25 | 25 | } |
26 | 26 | |
27 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
27 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
28 | 28 | |
29 | 29 | $console = new Application(); |
30 | 30 | //Hidratamos con los comandos de PSFS |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | |
35 | 35 | //Hidratamos con los comandos de los módulos |
36 | 36 | $domains = Router::getInstance()->getDomains(); |
37 | -foreach($domains as $domain => $paths) { |
|
38 | - if(!preg_match('/ROOT/i', $domain)) { |
|
37 | +foreach ($domains as $domain => $paths) { |
|
38 | + if (!preg_match('/ROOT/i', $domain)) { |
|
39 | 39 | $commands = new Finder(); |
40 | 40 | $commands->in($paths['base'])->path("Command")->name("*.php"); |
41 | 41 | foreach ($commands as $com) include_once($com->getRealPath()); |
@@ -30,7 +30,9 @@ discard block |
||
30 | 30 | //Hidratamos con los comandos de PSFS |
31 | 31 | $commands = new Finder(); |
32 | 32 | $commands->in(__DIR__)->notName("PSFSConsole.php"); |
33 | -foreach ($commands as $com) include_once($com->getRealPath()); |
|
33 | +foreach ($commands as $com) { |
|
34 | + include_once($com->getRealPath()); |
|
35 | +} |
|
34 | 36 | |
35 | 37 | //Hidratamos con los comandos de los módulos |
36 | 38 | $domains = Router::getInstance()->getDomains(); |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | if(!preg_match('/ROOT/i', $domain)) { |
39 | 41 | $commands = new Finder(); |
40 | 42 | $commands->in($paths['base'])->path("Command")->name("*.php"); |
41 | - foreach ($commands as $com) include_once($com->getRealPath()); |
|
43 | + foreach ($commands as $com) { |
|
44 | + include_once($com->getRealPath()); |
|
45 | + } |
|
42 | 46 | } |
43 | 47 | } |
44 | 48 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use PSFS\base\types\helpers\GeneratorHelper; |
17 | 17 | use PSFS\controller\ConfigController; |
18 | 18 | |
19 | -require_once __DIR__ . DIRECTORY_SEPARATOR . "bootstrap.php"; |
|
19 | +require_once __DIR__.DIRECTORY_SEPARATOR."bootstrap.php"; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Class Dispatcher |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | private function setLocale() |
78 | 78 | { |
79 | 79 | $this->locale = $this->config->get("default_language"); |
80 | - Logger::log('Set locale to project [' . $this->locale . ']'); |
|
80 | + Logger::log('Set locale to project ['.$this->locale.']'); |
|
81 | 81 | // Load translations |
82 | - putenv("LC_ALL=" . $this->locale); |
|
82 | + putenv("LC_ALL=".$this->locale); |
|
83 | 83 | setlocale(LC_ALL, $this->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'); |
@@ -104,18 +104,18 @@ discard block |
||
104 | 104 | if (!$this->parser->isFile()) { |
105 | 105 | return $this->router->execute($this->actualUri); |
106 | 106 | } |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | return ConfigController::getInstance()->config(); |
109 | 109 | } |
110 | - } catch (ConfigException $c) { |
|
110 | + }catch (ConfigException $c) { |
|
111 | 111 | return $this->dumpException($c); |
112 | - } catch (SecurityException $s) { |
|
112 | + }catch (SecurityException $s) { |
|
113 | 113 | return $this->security->notAuthorized($this->actualUri); |
114 | - } catch (UserAuthException $u) { |
|
114 | + }catch (UserAuthException $u) { |
|
115 | 115 | $this->redirectToHome(); |
116 | - } catch (RouterException $r) { |
|
116 | + }catch (RouterException $r) { |
|
117 | 117 | return $this->router->httpNotFound($r); |
118 | - } catch (\Exception $e) { |
|
118 | + }catch (\Exception $e) { |
|
119 | 119 | return $this->dumpException($e); |
120 | 120 | } |
121 | 121 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $use /= 1024; |
163 | 163 | break; |
164 | 164 | case "MBytes": |
165 | - $use /= (1024 * 1024); |
|
165 | + $use /= (1024*1024); |
|
166 | 166 | break; |
167 | 167 | case "Bytes": |
168 | 168 | default: |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | if ($this->config->getDebugMode() && $this->config->get('errors.strict', false)) { |
189 | 189 | Logger::log('Added handlers for errors'); |
190 | 190 | //Warning & Notice handler |
191 | - set_error_handler(function ($errno, $errstr, $errfile, $errline) { |
|
191 | + set_error_handler(function($errno, $errstr, $errfile, $errline) { |
|
192 | 192 | Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline]); |
193 | 193 | throw new \Exception($errstr, 500); |
194 | 194 | }); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | Logger::log('Initializing stats (mem + ts)'); |
204 | 204 | if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) { |
205 | 205 | $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT']; |
206 | - } else { |
|
206 | + }else { |
|
207 | 207 | $this->ts = $this->parser->getTs(); |
208 | 208 | } |
209 | 209 | $this->mem = memory_get_usage(); |