@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | $headers = []; |
90 | 90 | foreach ($this->getHeaders() as $key => $value) { |
91 | - $headers[] = $key . ': ' . $value; |
|
91 | + $headers[] = $key.': '.$value; |
|
92 | 92 | } |
93 | 93 | $headers[self::PSFS_TRACK_HEADER] = Logger::getUid(); |
94 | 94 | if (count($headers)) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | case Request::VERB_GET: |
119 | 119 | if (!empty($this->params)) { |
120 | 120 | $sep = !str_contains($this->getUrl(), '?') ? '?' : ''; |
121 | - $this->setUrl($this->getUrl() . $sep . http_build_query($this->getParams()), false); |
|
121 | + $this->setUrl($this->getUrl().$sep.http_build_query($this->getParams()), false); |
|
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case Request::VERB_POST: |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if ($this->isDebug() && is_resource($verbose)) { |
150 | 150 | $this->dumpVerboseLogs($verbose); |
151 | 151 | } |
152 | - Logger::log($this->getUrl() . ' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
152 | + Logger::log($this->getUrl().' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
153 | 153 | $this->info = array_merge($this->info, curl_getinfo($this->con)); |
154 | 154 | } |
155 | 155 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param true $isArray |
30 | 30 | * @return array |
31 | 31 | */ |
32 | - public function processPayload(array|string $namespace, bool $isArray): array |
|
32 | + public function processPayload(array | string $namespace, bool $isArray): array |
|
33 | 33 | { |
34 | 34 | if (false !== strpos($namespace, '[') && false !== strpos($namespace, ']')) { |
35 | 35 | $namespace = str_replace(']', '', str_replace('[', '', $namespace)); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | list($isArray, $payload) = $this->processPayload($namespace, $isArray); |
103 | 103 | $reflector = new ReflectionClass($namespace); |
104 | 104 | $shortName = $reflector->getShortName(); |
105 | - } else { |
|
105 | + }else { |
|
106 | 106 | $namespace = $model; |
107 | 107 | $shortName = $model; |
108 | 108 | } |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | if ($module === $requestModule && !preg_match('/^ROOT/i', $module)) { |
178 | 178 | $modules = [ |
179 | 179 | 'name' => $module, |
180 | - 'path' => realpath(dirname($info['base'] . DIRECTORY_SEPARATOR . '..')), |
|
180 | + 'path' => realpath(dirname($info['base'].DIRECTORY_SEPARATOR.'..')), |
|
181 | 181 | ]; |
182 | 182 | } |
183 | - } catch (Exception $e) { |
|
183 | + }catch (Exception $e) { |
|
184 | 184 | $modules[] = $e->getMessage(); |
185 | 185 | } |
186 | 186 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) { |
224 | 224 | $payload = $this->extractDtoProperties($namespace); |
225 | 225 | } |
226 | - } catch (Exception $e) { |
|
226 | + }catch (Exception $e) { |
|
227 | 227 | Logger::log($e->getMessage(), LOG_ERR); |
228 | 228 | } |
229 | 229 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | foreach ($domains as $domain => $routes) { |
38 | 38 | $pDomain = str_replace('@', '', $domain); |
39 | 39 | $pDomain = str_replace('/', '', $pDomain); |
40 | - $response[] = strtolower($pDomain) . '.api.secret'; |
|
40 | + $response[] = strtolower($pDomain).'.api.secret'; |
|
41 | 41 | } |
42 | 42 | return $this->json($response); |
43 | 43 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function config() |
55 | 55 | { |
56 | - Logger::log("Config loaded executed by " . $this->getRequest()->getRequestUri()); |
|
56 | + Logger::log("Config loaded executed by ".$this->getRequest()->getRequestUri()); |
|
57 | 57 | if (defined('PSFS_UNIT_TESTING_EXECUTION')) { |
58 | 58 | throw new ConfigException('CONFIG'); |
59 | 59 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | Security::getInstance()->setFlash("callback_message", t("Configuración actualizada correctamente")); |
94 | 94 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-config", true)); |
95 | - } else { |
|
95 | + }else { |
|
96 | 96 | throw new HttpException(t('Error al guardar la configuración, prueba a cambiar los permisos'), 403); |
97 | 97 | } |
98 | 98 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | GeneratorHelper::createDir(dirname($path)); |
58 | 58 | if (false === FileHelper::writeFile($path, $data)) { |
59 | - throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ') . $path); |
|
59 | + throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ').$path); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | Inspector::stats('[Cache] Gathering data from cache', Inspector::SCOPE_DEBUG); |
72 | 72 | $data = null; |
73 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
73 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
74 | 74 | if (file_exists($absolutePath)) { |
75 | 75 | $data = FileHelper::readFile($absolutePath); |
76 | 76 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
87 | 87 | { |
88 | 88 | Inspector::stats('[Cache] Checking expiration', Inspector::SCOPE_DEBUG); |
89 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
89 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
90 | 90 | $lasModificationDate = filemtime($absolutePath); |
91 | 91 | return ($lasModificationDate + $expires <= time()); |
92 | 92 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | Inspector::stats('[Cache] Store data in cache', Inspector::SCOPE_DEBUG); |
155 | 155 | $data = self::transformData($data, $transform); |
156 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
156 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
157 | 157 | $this->saveTextToFile($data, $absolutePath); |
158 | 158 | } |
159 | 159 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | public function readFromCache($path, $expires = 300, $function = null, $transform = Cache::TEXT, $ignoreExpiration = false) |
171 | 171 | { |
172 | 172 | $data = null; |
173 | - Inspector::stats('[Cache] Reading data from cache: ' . json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
174 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
173 | + Inspector::stats('[Cache] Reading data from cache: '.json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
174 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
175 | 175 | if (is_callable($function) && $this->hasExpiredCache($path, $expires) && !$ignoreExpiration) { |
176 | 176 | $data = $function(); |
177 | 177 | $this->storeData($path, $data, $transform); |
178 | - } else { |
|
178 | + }else { |
|
179 | 179 | $data = $this->getDataFromFile($path, $transform); |
180 | 180 | } |
181 | 181 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $query[Api::HEADER_API_LANG] = Request::header(Api::HEADER_API_LANG, 'es'); |
222 | 222 | $filename = FileHelper::generateHashFilename($action['http'], $action['slug'], $query); |
223 | 223 | $hashPath = FileHelper::generateCachePath($action, $query); |
224 | - Inspector::stats('[Cache] Cache file calculated: ' . json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
224 | + Inspector::stats('[Cache] Cache file calculated: '.json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
225 | 225 | Logger::log('Cache file calculated', LOG_DEBUG, ['file' => $filename, 'hash' => $hashPath]); |
226 | 226 | } |
227 | 227 | return [$hashPath, $filename]; |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | Inspector::stats('[Cache] Flushing cache', Inspector::SCOPE_DEBUG); |
234 | 234 | $action = Security::getInstance()->getSessionKey(self::CACHE_SESSION_VAR); |
235 | 235 | if (is_array($action)) { |
236 | - $hashPath = FileHelper::generateCachePath($action, $action['params']) . '..' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
236 | + $hashPath = FileHelper::generateCachePath($action, $action['params']).'..'.DIRECTORY_SEPARATOR.' .. '.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
237 | 237 | if (!file_exists($hashPath)) { |
238 | - $hashPath = CACHE_DIR . DIRECTORY_SEPARATOR . $hashPath; |
|
238 | + $hashPath = CACHE_DIR.DIRECTORY_SEPARATOR.$hashPath; |
|
239 | 239 | } |
240 | 240 | FileHelper::deleteDir($hashPath); |
241 | 241 | } |
@@ -8,24 +8,24 @@ |
||
8 | 8 | defined('JSON_THROW_ON_ERROR') or define('JSON_THROW_ON_ERROR', 4194304); |
9 | 9 | defined('JSON_INVALID_UTF8_SUBSTITUTE') or define('JSON_INVALID_UTF8_SUBSTITUTE', 2097152); |
10 | 10 | |
11 | -if (defined('PSFS_PHAR_DIR') && file_exists(PSFS_PHAR_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'environment.php')) { |
|
12 | - @require_once PSFS_PHAR_DIR . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'environment.php'; |
|
11 | +if (defined('PSFS_PHAR_DIR') && file_exists(PSFS_PHAR_DIR.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'environment.php')) { |
|
12 | + @require_once PSFS_PHAR_DIR.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'environment.php'; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | defined('SOURCE_DIR') or define('SOURCE_DIR', __DIR__); |
16 | 16 | if (str_contains(SOURCE_DIR, 'vendor')) { |
17 | - defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
18 | - defined('CORE_DIR') or define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
19 | -} else { |
|
20 | - defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
21 | - defined('CORE_DIR') or define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
17 | + defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
18 | + defined('CORE_DIR') or define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
19 | +}else { |
|
20 | + defined('BASE_DIR') or define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
21 | + defined('CORE_DIR') or define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
22 | 22 | } |
23 | -defined('VENDOR_DIR') or define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
24 | -defined('LOG_DIR') or define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
25 | -defined('CACHE_DIR') or define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
26 | -defined('CONFIG_DIR') or define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
27 | -defined('WEB_DIR') or define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
28 | -defined('LOCALE_DIR') or define('LOCALE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
23 | +defined('VENDOR_DIR') or define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor'); |
|
24 | +defined('LOG_DIR') or define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
25 | +defined('CACHE_DIR') or define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
26 | +defined('CONFIG_DIR') or define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
27 | +defined('WEB_DIR') or define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
28 | +defined('LOCALE_DIR') or define('LOCALE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
29 | 29 | |
30 | 30 | if (!class_exists(bootstrap::class)) { |
31 | 31 | /** |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | // autoloader |
15 | 15 | function PSFSAutoloader($class): false |
16 | 16 | { |
17 | - Logger::log("Trying to load class {$class} with " . __FILE__); |
|
17 | + Logger::log("Trying to load class {$class} with ".__FILE__); |
|
18 | 18 | // it only autoload class into the Rain scope |
19 | 19 | if (str_contains($class, 'PSFS')) { |
20 | 20 | // Change order src |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | $path = str_replace("\\", DIRECTORY_SEPARATOR, $class); |
24 | 24 | |
25 | 25 | // filepath |
26 | - $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php"; |
|
26 | + $abs_path = SOURCE_DIR.DIRECTORY_SEPARATOR.$path.".php"; |
|
27 | 27 | |
28 | 28 | // require the file |
29 | 29 | if (file_exists($abs_path)) { |
30 | 30 | require_once $abs_path; |
31 | - } else { |
|
32 | - Logger::log("{$class} not loaded with " . __FILE__); |
|
31 | + }else { |
|
32 | + Logger::log("{$class} not loaded with ".__FILE__); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | return false; |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | private function getPropelPaths(string $modulePath): array |
25 | 25 | { |
26 | - $moduleDir = CORE_DIR . DIRECTORY_SEPARATOR . $modulePath; |
|
26 | + $moduleDir = CORE_DIR.DIRECTORY_SEPARATOR.$modulePath; |
|
27 | 27 | GeneratorHelper::createDir($moduleDir); |
28 | 28 | $moduleDir = realpath($moduleDir); |
29 | - $configDir = $moduleDir . DIRECTORY_SEPARATOR . 'Config'; |
|
30 | - $sqlDir = $moduleDir . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'Sql'; |
|
31 | - $migrationDir = $moduleDir . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'Migrations'; |
|
29 | + $configDir = $moduleDir.DIRECTORY_SEPARATOR.'Config'; |
|
30 | + $sqlDir = $moduleDir.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'Sql'; |
|
31 | + $migrationDir = $moduleDir.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'Migrations'; |
|
32 | 32 | return [ |
33 | 33 | 'projectDir' => $moduleDir, |
34 | 34 | 'outputDir' => $moduleDir, |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | * @param AbstractManager $manager |
90 | 90 | * @param string $workingDir |
91 | 91 | */ |
92 | - private function setupManager(GeneratorConfig $configGenerator, AbstractManager &$manager, string $workingDir = CORE_DIR): void |
|
92 | + private function setupManager(GeneratorConfig $configGenerator, AbstractManager & $manager, string $workingDir = CORE_DIR): void |
|
93 | 93 | { |
94 | 94 | $manager->setGeneratorConfig($configGenerator); |
95 | - $schemaFile = new \SplFileInfo($configGenerator->getSection('paths')['schemaDir'] . DIRECTORY_SEPARATOR . 'schema.xml'); |
|
95 | + $schemaFile = new \SplFileInfo($configGenerator->getSection('paths')['schemaDir'].DIRECTORY_SEPARATOR.'schema.xml'); |
|
96 | 96 | $manager->setSchemas([$schemaFile]); |
97 | - $manager->setLoggerClosure(function ($message) { |
|
97 | + $manager->setLoggerClosure(function($message) { |
|
98 | 98 | Logger::log($message, LOG_INFO); |
99 | 99 | }); |
100 | 100 | $manager->setWorkingDirectory($workingDir); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return array List of schema files |
110 | 110 | */ |
111 | - protected function getSchemas(array|string $directory, bool $recursive = false): array |
|
111 | + protected function getSchemas(array | string $directory, bool $recursive = false): array |
|
112 | 112 | { |
113 | 113 | $finder = new Finder(); |
114 | 114 | $finder |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | { |
25 | 25 | Inspector::stats('[RouterHelper] Getting class to call for executing the request action', Inspector::SCOPE_DEBUG); |
26 | 26 | Logger::log('Getting class to call for executing the request action', LOG_DEBUG, $action); |
27 | - $actionClass = class_exists($action['class']) ? $action['class'] : "\\" . $action['class']; |
|
27 | + $actionClass = class_exists($action['class']) ? $action['class'] : "\\".$action['class']; |
|
28 | 28 | $reflectionClass = new ReflectionClass($actionClass); |
29 | 29 | if ($reflectionClass->hasMethod('getInstance')) { |
30 | 30 | $class = $reflectionClass->getMethod('getInstance')->invoke(null, $action['method']); |
31 | - } else { |
|
31 | + }else { |
|
32 | 32 | $class = new $actionClass; |
33 | 33 | } |
34 | 34 | return $class; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $expr = preg_quote($expr, '/'); |
128 | 128 | $expr = str_replace('%%%', '(.*)', $expr); |
129 | 129 | $expr2 = preg_replace('/\(\.\*\)$/', '', $expr); |
130 | - $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path); |
|
130 | + $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path); |
|
131 | 131 | return $matched; |
132 | 132 | } |
133 | 133 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public static function extractDomainInfo(ReflectionClass $class, string $domain): array |
140 | 140 | { |
141 | - $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
141 | + $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
142 | 142 | $templatesPath = 'templates'; |
143 | 143 | $publicPath = 'public'; |
144 | 144 | $modelsPath = 'models'; |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | $modelsPath = ucfirst($modelsPath); |
149 | 149 | } |
150 | 150 | if ($class->hasConstant('TPL')) { |
151 | - $templatesPath .= DIRECTORY_SEPARATOR . $class->getConstant('TPL'); |
|
151 | + $templatesPath .= DIRECTORY_SEPARATOR.$class->getConstant('TPL'); |
|
152 | 152 | } |
153 | 153 | return [ |
154 | 154 | 'base' => $path, |
155 | - 'template' => $path . $templatesPath, |
|
156 | - 'model' => $path . $modelsPath, |
|
157 | - 'public' => $path . $publicPath, |
|
155 | + 'template' => $path.$templatesPath, |
|
156 | + 'model' => $path.$modelsPath, |
|
157 | + 'public' => $path.$publicPath, |
|
158 | 158 | ]; |
159 | 159 | } |
160 | 160 | |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | foreach ($parameters as $param) { |
176 | 176 | if ($param->isOptional() && !is_array($param->getDefaultValue())) { |
177 | 177 | $params[$param->getName()] = $param->getDefaultValue(); |
178 | - $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue() ?: '', $regex ?: ''); |
|
178 | + $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue() ?: '', $regex ?: ''); |
|
179 | 179 | } elseif (!$param->isOptional()) { |
180 | 180 | $requirements[] = $param->getName(); |
181 | 181 | } |
182 | 182 | } |
183 | - } else { |
|
183 | + }else { |
|
184 | 184 | $default = $regex; |
185 | 185 | } |
186 | 186 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $httpMethod = AnnotationHelper::extractReflectionHttpMethod($docComments); |
211 | 211 | $icon = AnnotationHelper::extractDocIcon($docComments); |
212 | 212 | $label = AnnotationHelper::extractReflectionLabel(str_replace('{__API__}', $api, $docComments)); |
213 | - $route = $httpMethod . "#|#" . $regex; |
|
213 | + $route = $httpMethod."#|#".$regex; |
|
214 | 214 | $route = preg_replace('/(\\r|\\f|\\t|\\n)/', '', $route); |
215 | 215 | $info = [ |
216 | 216 | 'method' => $method->getName(), |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | && (preg_match('/^\/(admin|setup\-admin)/i', $route) || Config::getParam('restricted', false)) |
35 | 35 | ) { |
36 | 36 | if (!self::isTest() && |
37 | - null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) { |
|
37 | + null === Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true)) { |
|
38 | 38 | throw new AdminCredentialsException(); |
39 | 39 | } |
40 | 40 | if (!Security::getInstance()->checkAdmin()) { |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | $token = ''; |
55 | 55 | $length = strlen($timestamp); |
56 | 56 | for ($i = 0; $i < $length; $i++) { |
57 | - $token = substr($hash, $i, 1) . |
|
58 | - substr($timestamp, $i, 1) . |
|
57 | + $token = substr($hash, $i, 1). |
|
58 | + substr($timestamp, $i, 1). |
|
59 | 59 | $token; |
60 | 60 | } |
61 | 61 | return $token; |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | $charsLength = strlen(self::RAND_SEP) - 1; |
75 | 75 | $tsLength = strlen($timestamp); |
76 | 76 | $i = 0; |
77 | - $partCount = ceil($hashRest / 4); |
|
78 | - $part = substr($hash, $tsLength + $partCount * $i, $partCount); |
|
77 | + $partCount = ceil($hashRest/4); |
|
78 | + $part = substr($hash, $tsLength + $partCount*$i, $partCount); |
|
79 | 79 | while (false !== $part && strlen($part) > 0) { |
80 | - $mixedToken .= $part . |
|
81 | - substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1) . |
|
80 | + $mixedToken .= $part. |
|
81 | + substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1). |
|
82 | 82 | substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1); |
83 | - $part = substr($hash, $tsLength + $partCount * $i, $partCount); |
|
83 | + $part = substr($hash, $tsLength + $partCount*$i, $partCount); |
|
84 | 84 | $i++; |
85 | 85 | } |
86 | - return $mixedToken . $token; |
|
86 | + return $mixedToken.$token; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | private static function getTs(bool $isOdd = null): int |
94 | 94 | { |
95 | 95 | $timestamp = time(); |
96 | - $tsIsOdd = (bool)((int)substr($timestamp, -1) % 2); |
|
96 | + $tsIsOdd = (bool)((int)substr($timestamp, -1)%2); |
|
97 | 97 | if (false === $isOdd && !$tsIsOdd) { |
98 | 98 | $timestamp--; |
99 | 99 | } elseif (true === $isOdd && !$tsIsOdd) { |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | $timestamp = ''; |
130 | 130 | $part = strrev($part); |
131 | 131 | for ($i = 0, $ct = strlen($part); $i < $ct; $i++) { |
132 | - if ($i % 2 == 0) { |
|
132 | + if ($i%2 == 0) { |
|
133 | 133 | $timestamp .= substr($part, $i, 1); |
134 | - } else { |
|
134 | + }else { |
|
135 | 135 | $partToken .= substr($part, $i, 1); |
136 | 136 | } |
137 | 137 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | list($partToken, $timestamp) = self::extractTs(array_pop($parts)); |
149 | 149 | $token = null; |
150 | 150 | if ($timestamp > 0) { |
151 | - $token = $partToken . implode('', $parts); |
|
151 | + $token = $partToken.implode('', $parts); |
|
152 | 152 | } |
153 | 153 | return [$token, $timestamp]; |
154 | 154 | } |