@@ -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; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public static function httpNotFound(Exception $exception = NULL, $isJson = false) |
| 95 | 95 | { |
| 96 | - if(self::isTest()) { |
|
| 96 | + if (self::isTest()) { |
|
| 97 | 97 | return 404; |
| 98 | 98 | } |
| 99 | 99 | Inspector::stats('[Router] Throw not found exception', Inspector::SCOPE_DEBUG); |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $notFoundRoute = Config::getParam('route.404'); |
| 111 | - if(null !== $notFoundRoute) { |
|
| 111 | + if (null !== $notFoundRoute) { |
|
| 112 | 112 | Request::getInstance()->redirect(Router::getInstance()->getRoute($notFoundRoute, true)); |
| 113 | - } else { |
|
| 113 | + }else { |
|
| 114 | 114 | return $template->render('error.html.twig', array( |
| 115 | 115 | 'exception' => $exception, |
| 116 | 116 | 'trace' => $exception->getTraceAsString(), |
@@ -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; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | public static function extractComponents($route, $pattern) |
| 63 | 63 | { |
| 64 | 64 | Inspector::stats('[RouterHelper] Extracting parts for the request to execute', Inspector::SCOPE_DEBUG); |
| 65 | - if(Config::getParam('allow.double.slashes', true)) { |
|
| 65 | + if (Config::getParam('allow.double.slashes', true)) { |
|
| 66 | 66 | $route = preg_replace("/\/\//", '/', $route); |
| 67 | 67 | } |
| 68 | 68 | $url = parse_url($route); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $expr = preg_quote($expr, '/'); |
| 121 | 121 | $expr = str_replace('###', '(.*)', $expr); |
| 122 | 122 | $expr2 = preg_replace('/\(\.\*\)$/', '', $expr); |
| 123 | - $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path); |
|
| 123 | + $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path); |
|
| 124 | 124 | return $matched; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public static function extractDomainInfo(ReflectionClass $class, $domain) |
| 133 | 133 | { |
| 134 | - $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
| 134 | + $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
| 135 | 135 | $templatesPath = 'templates'; |
| 136 | 136 | $publicPath = 'public'; |
| 137 | 137 | $modelsPath = 'models'; |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | $modelsPath = ucfirst($modelsPath); |
| 142 | 142 | } |
| 143 | 143 | if ($class->hasConstant('TPL')) { |
| 144 | - $templatesPath .= DIRECTORY_SEPARATOR . $class->getConstant('TPL'); |
|
| 144 | + $templatesPath .= DIRECTORY_SEPARATOR.$class->getConstant('TPL'); |
|
| 145 | 145 | } |
| 146 | 146 | return [ |
| 147 | 147 | 'base' => $path, |
| 148 | - 'template' => $path . $templatesPath, |
|
| 149 | - 'model' => $path . $modelsPath, |
|
| 150 | - 'public' => $path . $publicPath, |
|
| 148 | + 'template' => $path.$templatesPath, |
|
| 149 | + 'model' => $path.$modelsPath, |
|
| 150 | + 'public' => $path.$publicPath, |
|
| 151 | 151 | ]; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | foreach ($parameters as $param) { |
| 169 | 169 | if ($param->isOptional() && !is_array($param->getDefaultValue())) { |
| 170 | 170 | $params[$param->getName()] = $param->getDefaultValue(); |
| 171 | - $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex); |
|
| 171 | + $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue(), $regex); |
|
| 172 | 172 | } elseif (!$param->isOptional()) { |
| 173 | 173 | $requirements[] = $param->getName(); |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | - } else { |
|
| 176 | + }else { |
|
| 177 | 177 | $default = $regex; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $httpMethod = AnnotationHelper::extractReflectionHttpMethod($docComments); |
| 204 | 204 | $icon = AnnotationHelper::extractDocIcon($docComments); |
| 205 | 205 | $label = AnnotationHelper::extractReflectionLabel(str_replace('{__API__}', $api, $docComments)); |
| 206 | - $route = $httpMethod . "#|#" . $regex; |
|
| 206 | + $route = $httpMethod."#|#".$regex; |
|
| 207 | 207 | $route = preg_replace('/(\\r|\\f|\\t|\\n)/', '', $route); |
| 208 | 208 | $info = [ |
| 209 | 209 | 'method' => $method->getName(), |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | if ($files->hasResults()) { |
| 53 | 53 | foreach ($files->getIterator() as $file) { |
| 54 | 54 | if ($namespace !== Router::PSFS_BASE_NAMESPACE && method_exists($file, 'getRelativePathname')) { |
| 55 | - $filename = '\\' . str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname())); |
|
| 56 | - } else { |
|
| 55 | + $filename = '\\'.str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname())); |
|
| 56 | + }else { |
|
| 57 | 57 | $filename = str_replace('/', '\\', str_replace($origen, '', $file->getPathname())); |
| 58 | 58 | } |
| 59 | - $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing, $namespace); |
|
| 59 | + $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing, $namespace); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | $this->initializeFinder(); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | if (!is_array($this->domains)) { |
| 110 | 110 | $this->domains = []; |
| 111 | 111 | } |
| 112 | - $domain = '@' . $class->getConstant('DOMAIN') . '/'; |
|
| 112 | + $domain = '@'.$class->getConstant('DOMAIN').'/'; |
|
| 113 | 113 | if (!array_key_exists($domain, $this->domains)) { |
| 114 | 114 | $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain); |
| 115 | 115 | } |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | private function loadExternalAutoloader($hydrateRoute, SplFileInfo $modulePath, $externalModulePath, &$routing = []) |
| 137 | 137 | { |
| 138 | 138 | $extModule = $modulePath->getBasename(); |
| 139 | - $moduleAutoloader = realpath($externalModulePath . DIRECTORY_SEPARATOR . $extModule . DIRECTORY_SEPARATOR . 'autoload.php'); |
|
| 139 | + $moduleAutoloader = realpath($externalModulePath.DIRECTORY_SEPARATOR.$extModule.DIRECTORY_SEPARATOR.'autoload.php'); |
|
| 140 | 140 | if (file_exists($moduleAutoloader)) { |
| 141 | 141 | include_once $moduleAutoloader; |
| 142 | 142 | if ($hydrateRoute) { |
| 143 | - $routing = $this->inspectDir($externalModulePath . DIRECTORY_SEPARATOR . $extModule, '\\' . $extModule, $routing); |
|
| 143 | + $routing = $this->inspectDir($externalModulePath.DIRECTORY_SEPARATOR.$extModule, '\\'.$extModule, $routing); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | try { |
| 157 | 157 | $module = preg_replace('/(\\\|\/)/', DIRECTORY_SEPARATOR, $module); |
| 158 | - $externalModulePath = VENDOR_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'src'; |
|
| 158 | + $externalModulePath = VENDOR_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'src'; |
|
| 159 | 159 | if (file_exists($externalModulePath)) { |
| 160 | 160 | $externalModule = $this->finder->directories()->in($externalModulePath)->depth(0); |
| 161 | 161 | if ($externalModule->hasResults()) { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | - } catch (Exception $e) { |
|
| 167 | + }catch (Exception $e) { |
|
| 168 | 168 | Logger::log($e->getMessage(), LOG_WARNING); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -176,9 +176,9 @@ discard block |
||
| 176 | 176 | public function domainExists($domainToCheck) { |
| 177 | 177 | $exists = false; |
| 178 | 178 | $domains = array_keys($this->getDomains()); |
| 179 | - foreach($domains as $domain) { |
|
| 179 | + foreach ($domains as $domain) { |
|
| 180 | 180 | $cleanDomain = strtolower(str_replace('@', '', $domain)); |
| 181 | - if($cleanDomain === strtolower($domainToCheck)) { |
|
| 181 | + if ($cleanDomain === strtolower($domainToCheck)) { |
|
| 182 | 182 | $exists = true; |
| 183 | 183 | break; |
| 184 | 184 | } |
@@ -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) { |
| 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($isOdd = null) |
| 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) { |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | $timestamp = ''; |
| 131 | 131 | $part = strrev($part); |
| 132 | 132 | for ($i = 0, $ct = strlen($part); $i < $ct; $i++) { |
| 133 | - if ($i % 2 == 0) { |
|
| 133 | + if ($i%2 == 0) { |
|
| 134 | 134 | $timestamp .= substr($part, $i, 1); |
| 135 | - } else { |
|
| 135 | + }else { |
|
| 136 | 136 | $partToken .= substr($part, $i, 1); |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | foreach ($parts as $part) { |
| 153 | 153 | $token .= $part; |
| 154 | 154 | } |
| 155 | - $token = $partToken . $token; |
|
| 155 | + $token = $partToken.$token; |
|
| 156 | 156 | } |
| 157 | 157 | return [$token, $timestamp]; |
| 158 | 158 | } |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function init() |
| 64 | 64 | { |
| 65 | - list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', $this->cacheType, TRUE); |
|
| 66 | - $this->domains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', $this->cacheType, TRUE); |
|
| 65 | + list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', $this->cacheType, TRUE); |
|
| 66 | + $this->domains = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', $this->cacheType, TRUE); |
|
| 67 | 67 | if (empty($this->routing) || Config::getParam('debug', true)) { |
| 68 | 68 | $this->debugLoad(); |
| 69 | 69 | } |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | try { |
| 99 | 99 | //Search action and execute |
| 100 | 100 | return $this->searchAction($route); |
| 101 | - } catch (AccessDeniedException $e) { |
|
| 102 | - Logger::log(t('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile() . '[' . $e->getLine() . ']']); |
|
| 101 | + }catch (AccessDeniedException $e) { |
|
| 102 | + Logger::log(t('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile().'['.$e->getLine().']']); |
|
| 103 | 103 | return Admin::staticAdminLogon(); |
| 104 | - } catch (RouterException $r) { |
|
| 104 | + }catch (RouterException $r) { |
|
| 105 | 105 | Logger::log($r->getMessage(), LOG_WARNING); |
| 106 | 106 | $code = $r->getCode(); |
| 107 | - } catch (Exception $e) { |
|
| 107 | + }catch (Exception $e) { |
|
| 108 | 108 | Logger::log($e->getMessage(), LOG_ERR); |
| 109 | 109 | throw $e; |
| 110 | 110 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | protected function searchAction($route) |
| 124 | 124 | { |
| 125 | - Inspector::stats('[Router] Searching action to execute: ' . $route, Inspector::SCOPE_DEBUG); |
|
| 125 | + Inspector::stats('[Router] Searching action to execute: '.$route, Inspector::SCOPE_DEBUG); |
|
| 126 | 126 | //Revisamos si tenemos la ruta registrada |
| 127 | 127 | $parts = parse_url($route); |
| 128 | 128 | $path = array_key_exists('path', $parts) ? $parts['path'] : $route; |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | try { |
| 140 | 140 | if ($this->checkRequirements($action, $get)) { |
| 141 | 141 | return $this->executeCachedRoute($route, $action, $class, $get); |
| 142 | - } else { |
|
| 142 | + }else { |
|
| 143 | 143 | throw new RouterException(t('Preconditions failed'), 412); |
| 144 | 144 | } |
| 145 | - } catch (Exception $e) { |
|
| 145 | + }catch (Exception $e) { |
|
| 146 | 146 | Logger::log($e->getMessage(), LOG_ERR); |
| 147 | 147 | throw $e; |
| 148 | 148 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | $valid = count($action['requirements']) === $checked; |
| 170 | - } else { |
|
| 170 | + }else { |
|
| 171 | 171 | $valid = true; |
| 172 | 172 | } |
| 173 | 173 | return $valid; |
@@ -190,11 +190,11 @@ discard block |
||
| 190 | 190 | if ($modules->hasResults()) { |
| 191 | 191 | foreach ($modules->getIterator() as $modulePath) { |
| 192 | 192 | $module = $modulePath->getBasename(); |
| 193 | - $this->routing = $this->inspectDir($modulesPath . DIRECTORY_SEPARATOR . $module, $module, $this->routing); |
|
| 193 | + $this->routing = $this->inspectDir($modulesPath.DIRECTORY_SEPARATOR.$module, $module, $this->routing); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | - $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', $this->domains, Cache::JSON, TRUE); |
|
| 197 | + $this->cache->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', $this->domains, Cache::JSON, TRUE); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $homeParams = NULL; |
| 212 | 212 | foreach ($this->routing as $pattern => $params) { |
| 213 | 213 | list($method, $route) = RouterHelper::extractHttpRoute($pattern); |
| 214 | - if (preg_match('/' . preg_quote($route, '/') . '$/i', '/' . $home)) { |
|
| 214 | + if (preg_match('/'.preg_quote($route, '/').'$/i', '/'.$home)) { |
|
| 215 | 215 | $homeParams = $params; |
| 216 | 216 | } |
| 217 | 217 | unset($method); |
@@ -243,18 +243,18 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | $baseUrl = $absolute ? Request::getInstance()->getRootUrl() : ''; |
| 245 | 245 | if ('' === $slug) { |
| 246 | - return $baseUrl . '/'; |
|
| 246 | + return $baseUrl.'/'; |
|
| 247 | 247 | } |
| 248 | 248 | if (!is_array($this->slugs) || !array_key_exists($slug, $this->slugs)) { |
| 249 | 249 | throw new RouterException(t('No existe la ruta especificada')); |
| 250 | 250 | } |
| 251 | - $url = $baseUrl . $this->slugs[$slug]; |
|
| 251 | + $url = $baseUrl.$this->slugs[$slug]; |
|
| 252 | 252 | if (!empty($params)) { |
| 253 | 253 | foreach ($params as $key => $value) { |
| 254 | - $url = str_replace('{' . $key . '}', $value, $url); |
|
| 254 | + $url = str_replace('{'.$key.'}', $value, $url); |
|
| 255 | 255 | } |
| 256 | 256 | } elseif (!empty($this->routing[$this->slugs[$slug]]['default'])) { |
| 257 | - $url = $baseUrl . $this->routing[$this->slugs[$slug]]['default']; |
|
| 257 | + $url = $baseUrl.$this->routing[$this->slugs[$slug]]['default']; |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | return preg_replace('/(GET|POST|PUT|DELETE|ALL|HEAD|PATCH)\#\|\#/', '', $url); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | private function checkPreActions($class, $method) |
| 268 | 268 | { |
| 269 | - $preAction = 'pre' . ucfirst($method); |
|
| 269 | + $preAction = 'pre'.ucfirst($method); |
|
| 270 | 270 | if (method_exists($class, $preAction)) { |
| 271 | 271 | Inspector::stats('[Router] Pre action invoked', Inspector::SCOPE_DEBUG); |
| 272 | 272 | try { |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | Logger::log(t('Pre action failed'), LOG_ERR, [error_get_last()]); |
| 275 | 275 | error_clear_last(); |
| 276 | 276 | } |
| 277 | - } catch (Exception $e) { |
|
| 277 | + }catch (Exception $e) { |
|
| 278 | 278 | Logger::log($e->getMessage(), LOG_ERR, [$class, $method]); |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | protected function executeCachedRoute($route, $action, $class, $params = NULL) |
| 293 | 293 | { |
| 294 | - Inspector::stats('[Router] Executing route ' . $route, Inspector::SCOPE_DEBUG); |
|
| 294 | + Inspector::stats('[Router] Executing route '.$route, Inspector::SCOPE_DEBUG); |
|
| 295 | 295 | $action['params'] = array_merge($action['params'], $params, Request::getInstance()->getQueryParams()); |
| 296 | 296 | Security::getInstance()->setSessionKey(Cache::CACHE_SESSION_VAR, $action); |
| 297 | 297 | $cache = Cache::needCache(); |
@@ -299,15 +299,15 @@ discard block |
||
| 299 | 299 | $return = null; |
| 300 | 300 | if (FALSE !== $cache && $action['http'] === 'GET' && Config::getParam('debug') === FALSE) { |
| 301 | 301 | list($path, $cacheDataName) = $this->cache->getRequestCacheHash(); |
| 302 | - $cachedData = $this->cache->readFromCache('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName, $cache); |
|
| 302 | + $cachedData = $this->cache->readFromCache('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName, $cache); |
|
| 303 | 303 | if (NULL !== $cachedData) { |
| 304 | - $headers = $this->cache->readFromCache('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName . '.headers', $cache, null, Cache::JSON); |
|
| 304 | + $headers = $this->cache->readFromCache('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName.'.headers', $cache, null, Cache::JSON); |
|
| 305 | 305 | Template::getInstance()->renderCache($cachedData, $headers); |
| 306 | 306 | $execute = FALSE; |
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | if ($execute) { |
| 310 | - Inspector::stats('[Router] Start executing action ' . $route, Inspector::SCOPE_DEBUG); |
|
| 310 | + Inspector::stats('[Router] Start executing action '.$route, Inspector::SCOPE_DEBUG); |
|
| 311 | 311 | $this->checkPreActions($class, $action['method']); |
| 312 | 312 | $return = call_user_func_array([$class, $action['method']], $params); |
| 313 | 313 | if (false === $return) { |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | { |
| 51 | 51 | $this->generateSlugs(); |
| 52 | 52 | GeneratorHelper::createDir(CONFIG_DIR); |
| 53 | - Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', [$this->routing, $this->getSlugs()], Cache::JSON, TRUE); |
|
| 53 | + Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', [$this->routing, $this->getSlugs()], Cache::JSON, TRUE); |
|
| 54 | 54 | |
| 55 | 55 | return $this; |
| 56 | 56 | } |