@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | $objects = scandir($dir); |
28 | 28 | foreach ($objects as $object) { |
29 | 29 | if ($object != "." && $object != "..") { |
30 | - if (filetype($dir . "/" . $object) == "dir") { |
|
31 | - self::deleteDir($dir . "/" . $object); |
|
32 | - } else { |
|
33 | - unlink($dir . "/" . $object); |
|
30 | + if (filetype($dir."/".$object) == "dir") { |
|
31 | + self::deleteDir($dir."/".$object); |
|
32 | + }else { |
|
33 | + unlink($dir."/".$object); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | } |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | { |
46 | 46 | $rootDirs = array("css", "js", "media", "font"); |
47 | 47 | foreach ($rootDirs as $dir) { |
48 | - if (file_exists(WEB_DIR . DIRECTORY_SEPARATOR . $dir)) { |
|
48 | + if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) { |
|
49 | 49 | try { |
50 | - self::deleteDir(WEB_DIR . DIRECTORY_SEPARATOR . $dir); |
|
51 | - } catch (Exception $e) { |
|
50 | + self::deleteDir(WEB_DIR.DIRECTORY_SEPARATOR.$dir); |
|
51 | + }catch (Exception $e) { |
|
52 | 52 | syslog(LOG_INFO, $e->getMessage()); |
53 | 53 | } |
54 | 54 | } |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | if (!empty($dir)) { |
66 | 66 | try { |
67 | 67 | if (!is_dir($dir) && @mkdir($dir, 0775, true) === false) { |
68 | - throw new Exception(t('Can\'t create directory ') . $dir); |
|
68 | + throw new Exception(t('Can\'t create directory ').$dir); |
|
69 | 69 | } |
70 | - } catch (Exception $e) { |
|
70 | + }catch (Exception $e) { |
|
71 | 71 | syslog(LOG_WARNING, $e->getMessage()); |
72 | 72 | if (!file_exists(dirname($dir))) { |
73 | - throw new GeneratorException($e->getMessage() . $dir); |
|
73 | + throw new GeneratorException($e->getMessage().$dir); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public static function getTemplatePath(): string |
84 | 84 | { |
85 | - $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; |
|
85 | + $path = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR; |
|
86 | 86 | return realpath($path); |
87 | 87 | } |
88 | 88 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } elseif (!$reflector->isAbstract()) { |
111 | 111 | throw new GeneratorException(t('La clase definida debe ser abstracta'), 501); |
112 | 112 | } |
113 | - } else { |
|
113 | + }else { |
|
114 | 114 | throw new GeneratorException(t('La clase definida para extender la API no existe'), 501); |
115 | 115 | } |
116 | 116 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | GeneratorHelper::createDir($path); |
133 | 133 | $paths = array("js", "css", "img", "media", "font"); |
134 | 134 | foreach ($paths as $htmlPath) { |
135 | - GeneratorHelper::createDir($path . DIRECTORY_SEPARATOR . $htmlPath); |
|
135 | + GeneratorHelper::createDir($path.DIRECTORY_SEPARATOR.$htmlPath); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | // Generates the root needed files |
@@ -142,31 +142,31 @@ discard block |
||
142 | 142 | 'crossdomain' => 'crossdomain.xml', |
143 | 143 | 'humans' => 'humans.txt', |
144 | 144 | 'robots' => 'robots.txt', |
145 | - 'docker' => '..' . DIRECTORY_SEPARATOR . 'docker-compose.yml', |
|
145 | + 'docker' => '..'.DIRECTORY_SEPARATOR.'docker-compose.yml', |
|
146 | 146 | ]; |
147 | 147 | $verificable = ['humans', 'robots', 'docker']; |
148 | 148 | $output->writeln('Start creating html files'); |
149 | 149 | foreach ($files as $template => $filename) { |
150 | - if (in_array($template, $verificable) && file_exists($path . DIRECTORY_SEPARATOR . $filename)) { |
|
151 | - $output->writeln($filename . ' already exists'); |
|
150 | + if (in_array($template, $verificable) && file_exists($path.DIRECTORY_SEPARATOR.$filename)) { |
|
151 | + $output->writeln($filename.' already exists'); |
|
152 | 152 | continue; |
153 | 153 | } |
154 | - $text = Template::getInstance()->dump("generator/html/" . $template . '.html.twig'); |
|
155 | - if (false === file_put_contents($path . DIRECTORY_SEPARATOR . $filename, $text)) { |
|
154 | + $text = Template::getInstance()->dump("generator/html/".$template.'.html.twig'); |
|
155 | + if (false === file_put_contents($path.DIRECTORY_SEPARATOR.$filename, $text)) { |
|
156 | 156 | if (!$quiet) { |
157 | - $output->writeln('Can\t create the file ' . $filename); |
|
157 | + $output->writeln('Can\t create the file '.$filename); |
|
158 | 158 | } |
159 | - } else { |
|
159 | + }else { |
|
160 | 160 | if (!$quiet) { |
161 | - $output->writeln($filename . ' created successfully'); |
|
161 | + $output->writeln($filename.' created successfully'); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | 166 | //Export base locale translations |
167 | - if (!file_exists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale')) { |
|
168 | - GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
169 | - self::copyr(SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
167 | + if (!file_exists(BASE_DIR.DIRECTORY_SEPARATOR.'locale')) { |
|
168 | + GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
169 | + self::copyr(SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | { |
183 | 183 | if (file_exists($filenamePath)) { |
184 | 184 | $destfolder = basename($filenamePath); |
185 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
185 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
186 | 186 | if (is_dir($filenamePath)) { |
187 | - self::copyr($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
188 | - } else { |
|
189 | - if (@copy($filenamePath, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
190 | - throw new ConfigException("Can't copy " . $filenamePath . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
187 | + self::copyr($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
188 | + }else { |
|
189 | + if (@copy($filenamePath, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
190 | + throw new ConfigException("Can't copy ".$filenamePath." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | self::createDir($dst); |
207 | 207 | while (false !== ($file = readdir($dir))) { |
208 | 208 | if (($file != '.') && ($file != '..')) { |
209 | - if (is_dir($src . '/' . $file)) { |
|
210 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
211 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
212 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
209 | + if (is_dir($src.'/'.$file)) { |
|
210 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
211 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
212 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | */ |
97 | 97 | public static function extractFromDoc(string $needle, string $comments, string $default = null): ?string |
98 | 98 | { |
99 | - preg_match('/@' . $needle . '\ (.*)(\n|\r)/im', $comments, $matches); |
|
99 | + preg_match('/@'.$needle.'\ (.*)(\n|\r)/im', $comments, $matches); |
|
100 | 100 | return (count($matches) > 0) ? $matches[1] : $default; |
101 | 101 | } |
102 | 102 | } |
@@ -24,10 +24,10 @@ |
||
24 | 24 | $now = new DateTime(); |
25 | 25 | $now->setTimezone(new DateTimeZone(Config::getParam('project.timezone', 'Europe/Madrid'))); |
26 | 26 | $config = Config::getInstance()->dumpConfig(); |
27 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $config[self::CACHE_VAR_TAG] . '.file.cache')) { |
|
28 | - unlink(CACHE_DIR . DIRECTORY_SEPARATOR . $config[self::CACHE_VAR_TAG] . '.file.cache'); |
|
27 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$config[self::CACHE_VAR_TAG].'.file.cache')) { |
|
28 | + unlink(CACHE_DIR.DIRECTORY_SEPARATOR.$config[self::CACHE_VAR_TAG].'.file.cache'); |
|
29 | 29 | } |
30 | - $config[self::CACHE_VAR_TAG] = 'v' . $now->format('Ymd.His'); |
|
30 | + $config[self::CACHE_VAR_TAG] = 'v'.$now->format('Ymd.His'); |
|
31 | 31 | Config::save($config); |
32 | 32 | return $config[self::CACHE_VAR_TAG]; |
33 | 33 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | // TODO check more en locales |
47 | 47 | if (strtolower($locale) === 'en') { |
48 | 48 | $locale = 'en_GB'; |
49 | - } else { |
|
50 | - $locale = $locale . '_' . strtoupper($locale); |
|
49 | + }else { |
|
50 | + $locale = $locale.'_'.strtoupper($locale); |
|
51 | 51 | } |
52 | 52 | $defaultLocales = explode(',', Config::getParam('i18n.locales', '')); |
53 | 53 | if (!in_array($locale, array_merge($defaultLocales, self::$langs))) { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $translations = array(); |
67 | 67 | if (file_exists($absoluteFileName)) { |
68 | 68 | @include($absoluteFileName); |
69 | - } else { |
|
69 | + }else { |
|
70 | 70 | Cache::getInstance()->storeData($absoluteFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE); |
71 | 71 | } |
72 | 72 | |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | public static function setLocale(string $default = null, string $customKey = null, bool $force = false): void |
84 | 84 | { |
85 | 85 | $locale = $force ? $default : self::extractLocale($default); |
86 | - Inspector::stats('[i18NHelper] Set locale to project [' . $locale . ']', Inspector::SCOPE_DEBUG); |
|
86 | + Inspector::stats('[i18NHelper] Set locale to project ['.$locale.']', Inspector::SCOPE_DEBUG); |
|
87 | 87 | // Load translations |
88 | - putenv("LC_ALL=" . $locale); |
|
88 | + putenv("LC_ALL=".$locale); |
|
89 | 89 | setlocale(LC_ALL, $locale); |
90 | 90 | // Load the locale path |
91 | - $localePath = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
92 | - Logger::log('Set locale dir ' . $localePath); |
|
91 | + $localePath = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
92 | + Logger::log('Set locale dir '.$localePath); |
|
93 | 93 | GeneratorHelper::createDir($localePath); |
94 | 94 | bindtextdomain('translations', $localePath); |
95 | 95 | textdomain('translations'); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ['i', 'i', 'i', 'i', 'I', 'I', 'I', 'I'], |
156 | 156 | ['o', 'o', 'o', 'o', 'O', 'O', 'O', 'O'], |
157 | 157 | ['u', 'u', 'u', 'u', 'U', 'U', 'U', 'U'], |
158 | - ['n', 'N', 'c', 'C',], |
|
158 | + ['n', 'N', 'c', 'C', ], |
|
159 | 159 | ]; |
160 | 160 | |
161 | 161 | $text = htmlspecialchars($string); |
@@ -175,24 +175,24 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public static function findTranslations(string $path, string $locale): array |
177 | 177 | { |
178 | - $localePath = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
179 | - $localePath .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
178 | + $localePath = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
179 | + $localePath .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
180 | 180 | |
181 | 181 | $translations = array(); |
182 | 182 | if (file_exists($path)) { |
183 | 183 | $directory = dir($path); |
184 | 184 | while (false !== ($fileName = $directory->read())) { |
185 | 185 | GeneratorHelper::createDir($localePath); |
186 | - if (!file_exists($localePath . 'translations.po')) { |
|
187 | - file_put_contents($localePath . 'translations.po', ''); |
|
186 | + if (!file_exists($localePath.'translations.po')) { |
|
187 | + file_put_contents($localePath.'translations.po', ''); |
|
188 | 188 | } |
189 | - $inspectPath = realpath($path . DIRECTORY_SEPARATOR . $fileName); |
|
190 | - $cmdPhp = "export PATH=\$PATH:/opt/local/bin; xgettext " . |
|
191 | - $inspectPath . DIRECTORY_SEPARATOR . |
|
189 | + $inspectPath = realpath($path.DIRECTORY_SEPARATOR.$fileName); |
|
190 | + $cmdPhp = "export PATH=\$PATH:/opt/local/bin; xgettext ". |
|
191 | + $inspectPath.DIRECTORY_SEPARATOR. |
|
192 | 192 | "*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$localePath}translations.po"; |
193 | - if (is_dir($path . DIRECTORY_SEPARATOR . $fileName) && preg_match('/^\./', $fileName) == 0) { |
|
194 | - $res = t('Revisando directorio: ') . $inspectPath; |
|
195 | - $res .= t('Comando ejecutado: ') . $cmdPhp; |
|
193 | + if (is_dir($path.DIRECTORY_SEPARATOR.$fileName) && preg_match('/^\./', $fileName) == 0) { |
|
194 | + $res = t('Revisando directorio: ').$inspectPath; |
|
195 | + $res .= t('Comando ejecutado: ').$cmdPhp; |
|
196 | 196 | $res .= shell_exec($cmdPhp); |
197 | 197 | usleep(10); |
198 | 198 | $translations[] = $res; |
@@ -95,7 +95,9 @@ |
||
95 | 95 | textdomain('translations'); |
96 | 96 | bind_textdomain_codeset('translations', 'UTF-8'); |
97 | 97 | Security::getInstance()->setSessionKey(I18nHelper::PSFS_SESSION_LANGUAGE_KEY, substr($locale, 0, 2)); |
98 | - if ($force) t('', $customKey, true); |
|
98 | + if ($force) { |
|
99 | + t('', $customKey, true); |
|
100 | + } |
|
99 | 101 | } |
100 | 102 | |
101 | 103 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'required' => $isRequired, |
44 | 44 | 'description' => $label, |
45 | 45 | ]; |
46 | - } else { |
|
46 | + }else { |
|
47 | 47 | $instance = new ReflectionClass($instanceType); |
48 | 48 | $variables[$property->getName()] = [ |
49 | 49 | 'is_array' => $isArray, |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public static function constructInjectableInstance($variable, $singleton, $classNameSpace, $calledClass) |
161 | 161 | { |
162 | - Logger::log('Create inyectable instance for ' . $classNameSpace); |
|
162 | + Logger::log('Create inyectable instance for '.$classNameSpace); |
|
163 | 163 | $reflector = new ReflectionClass($calledClass); |
164 | 164 | $property = $reflector->getProperty($variable); |
165 | 165 | $varInstanceType = (null === $classNameSpace) ? InjectorHelper::extractVarType($property->getDocComment()) : $classNameSpace; |
166 | 166 | if (true === $singleton && method_exists($varInstanceType, 'getInstance')) { |
167 | 167 | $instance = $varInstanceType::getInstance(); |
168 | - } else { |
|
168 | + }else { |
|
169 | 169 | $instance = new $varInstanceType(); |
170 | 170 | } |
171 | 171 | return $instance; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | public static function getClassProperties($class) |
180 | 180 | { |
181 | 181 | $properties = []; |
182 | - Logger::log('Extracting annotations properties from class ' . $class); |
|
182 | + Logger::log('Extracting annotations properties from class '.$class); |
|
183 | 183 | $selfReflector = new ReflectionClass($class); |
184 | 184 | if (false !== $selfReflector->getParentClass()) { |
185 | 185 | $properties = self::getClassProperties($selfReflector->getParentClass()->getName()); |
@@ -52,7 +52,7 @@ |
||
52 | 52 | { |
53 | 53 | return [ |
54 | 54 | 'ts' => round($stats['ts'] - $timestamp, 4), |
55 | - 'mem' => round(($stats['mem'] - $mem) / 1024 / 1024, 4), |
|
55 | + 'mem' => round(($stats['mem'] - $mem)/1024/1024, 4), |
|
56 | 56 | 'files' => $stats['files'] - $files, |
57 | 57 | 'name' => $stats['name'], |
58 | 58 | ]; |
@@ -66,26 +66,26 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return string[] |
68 | 68 | */ |
69 | - public static function calculateAssetPath(string $string, string|null $name = null, bool $return = true, string $filenamePath = ''): array |
|
69 | + public static function calculateAssetPath(string $string, string | null $name = null, bool $return = true, string $filenamePath = ''): array |
|
70 | 70 | { |
71 | 71 | $path = explode("/", $string); |
72 | 72 | $originalFilename = end($path); |
73 | - $base = WEB_DIR . DIRECTORY_SEPARATOR; |
|
73 | + $base = WEB_DIR.DIRECTORY_SEPARATOR; |
|
74 | 74 | $debug = Config::getParam('debug'); |
75 | 75 | $cache = Config::getParam('cache.var'); |
76 | - $cache = $cache ? '.' . $cache : ''; |
|
76 | + $cache = $cache ? '.'.$cache : ''; |
|
77 | 77 | $finfo = finfo_open(FILEINFO_MIME_TYPE); // devuelve el tipo mime de su extensión |
78 | 78 | $mime = finfo_file($finfo, $filenamePath); |
79 | 79 | $extension = explode(".", $string); |
80 | 80 | $extension = end($extension); |
81 | - $file = "/" . substr(md5($string), 0, 8) . "." . $extension; |
|
81 | + $file = "/".substr(md5($string), 0, 8).".".$extension; |
|
82 | 82 | $htmlBase = ''; |
83 | 83 | finfo_close($finfo); |
84 | 84 | if (preg_match('/\.css$/i', $string)) { |
85 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.css"; |
|
85 | + $file = "/".substr(md5($string), 0, 8)."$cache.css"; |
|
86 | 86 | $htmlBase = "css"; |
87 | 87 | } elseif (preg_match('/\.js$/i', $string)) { |
88 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.js"; |
|
88 | + $file = "/".substr(md5($string), 0, 8)."$cache.js"; |
|
89 | 89 | $htmlBase = "js"; |
90 | 90 | } elseif (preg_match("/image/i", $mime)) { |
91 | 91 | $htmlBase = "img"; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | $file = $name; |
100 | 100 | } |
101 | 101 | if ($debug) { |
102 | - $file = str_replace("." . $extension, "_" . $originalFilename, $file); |
|
102 | + $file = str_replace(".".$extension, "_".$originalFilename, $file); |
|
103 | 103 | } |
104 | - $filePath = $htmlBase . $file; |
|
104 | + $filePath = $htmlBase.$file; |
|
105 | 105 | |
106 | 106 | return array($base, $htmlBase, $filePath); |
107 | 107 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | { |
117 | 117 | GeneratorHelper::createDir(dirname($path)); |
118 | 118 | if ("" !== $content && false === file_put_contents($path, $content)) { |
119 | - throw new ConfigException(t('No se tienen permisos para escribir en ' . $path)); |
|
119 | + throw new ConfigException(t('No se tienen permisos para escribir en '.$path)); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | Logger::log('Adding debug headers to render response'); |
77 | 77 | $vars["__DEBUG__"]["includes"] = get_included_files(); |
78 | 78 | $vars["__DEBUG__"]["trace"] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
79 | - header('X-PSFS-DEBUG-TS: ' . Dispatcher::getInstance()->getTs() . ' s'); |
|
80 | - header('X-PSFS-DEBUG-MEM: ' . Dispatcher::getInstance()->getMem('MBytes') . ' MBytes'); |
|
81 | - header('X-PSFS-DEBUG-FILES: ' . count(get_included_files()) . ' files opened'); |
|
79 | + header('X-PSFS-DEBUG-TS: '.Dispatcher::getInstance()->getTs().' s'); |
|
80 | + header('X-PSFS-DEBUG-MEM: '.Dispatcher::getInstance()->getMem('MBytes').' MBytes'); |
|
81 | + header('X-PSFS-DEBUG-FILES: '.count(get_included_files()).' files opened'); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $vars; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return int|string |
91 | 91 | * @throws GeneratorException |
92 | 92 | */ |
93 | - public static function httpNotFound(Exception $exception = NULL, bool $isJson = false): int|string |
|
93 | + public static function httpNotFound(Exception $exception = NULL, bool $isJson = false): int | string |
|
94 | 94 | { |
95 | 95 | if (self::isTest()) { |
96 | 96 | return 404; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $notFoundRoute = Config::getParam('route.404'); |
110 | 110 | if (null !== $notFoundRoute) { |
111 | 111 | Request::getInstance()->redirect(Router::getInstance()->getRoute($notFoundRoute, true)); |
112 | - } else { |
|
112 | + }else { |
|
113 | 113 | return $template->render('error.html.twig', array( |
114 | 114 | 'exception' => $exception, |
115 | 115 | 'trace' => $exception->getTraceAsString(), |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function init() |
99 | 99 | { |
100 | - if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) { |
|
100 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) { |
|
101 | 101 | $this->loadConfigData(); |
102 | 102 | } |
103 | 103 | return $this; |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | $finalData = self::saveExtraParams($data); |
213 | 213 | $saved = false; |
214 | 214 | try { |
215 | - $finalData = array_filter($finalData, function ($key, $value) { |
|
215 | + $finalData = array_filter($finalData, function($key, $value) { |
|
216 | 216 | return in_array($key, self::$required, true) || !empty($value); |
217 | 217 | }, ARRAY_FILTER_USE_BOTH); |
218 | - $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($finalData, JSON_PRETTY_PRINT))); |
|
218 | + $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($finalData, JSON_PRETTY_PRINT))); |
|
219 | 219 | self::getInstance()->loadConfigData(); |
220 | 220 | $saved = true; |
221 | - } catch (ConfigException $e) { |
|
221 | + }catch (ConfigException $e) { |
|
222 | 222 | Logger::log($e->getMessage(), LOG_ERR); |
223 | 223 | } |
224 | 224 | return $saved; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function loadConfigData() |
252 | 252 | { |
253 | - $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: []; |
|
253 | + $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: []; |
|
254 | 254 | $this->debug = array_key_exists('debug', $this->config) ? (bool)$this->config['debug'] : FALSE; |
255 | 255 | if (array_key_exists('cache.var', $this->config)) { |
256 | 256 | Security::getInstance()->setSessionKey('config.cache.var', $this->config['cache.var']); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | public static function getParam($key, $defaultValue = null, $module = null) |
276 | 276 | { |
277 | 277 | if (null !== $module) { |
278 | - return self::getParam(strtolower($module) . '.' . $key, self::getParam($key, $defaultValue)); |
|
278 | + return self::getParam(strtolower($module).'.'.$key, self::getParam($key, $defaultValue)); |
|
279 | 279 | } |
280 | 280 | $param = self::getInstance()->get($key); |
281 | 281 | return (null !== $param) ? $param : $defaultValue; |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | { |
292 | 292 | $done = true; |
293 | 293 | foreach (self::$cleanable_config_files as $configFile) { |
294 | - if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . $configFile)) { |
|
295 | - if (!unlink(CONFIG_DIR . DIRECTORY_SEPARATOR . $configFile)) { |
|
294 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.$configFile)) { |
|
295 | + if (!unlink(CONFIG_DIR.DIRECTORY_SEPARATOR.$configFile)) { |
|
296 | 296 | $done = false; |
297 | 297 | } |
298 | 298 | } |