@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @var array |
27 | 27 | */ |
28 | - private $resolver = ['isClosureAndTemplate','isControllerAndTemplate','isTemplate']; |
|
28 | + private $resolver = ['isClosureAndTemplate', 'isControllerAndTemplate', 'isTemplate']; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @var array |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | 'isClosure' => 'JetFire\Routing\Dispatcher\ClosureDispatcher', |
35 | 35 | 'isController' => 'JetFire\Routing\Dispatcher\ControllerDispatcher', |
36 | 36 | 'isTemplate' => 'JetFire\Routing\Dispatcher\TemplateDispatcher', |
37 | - 'isControllerAndTemplate' => ['JetFire\Routing\Dispatcher\ControllerDispatcher','JetFire\Routing\Dispatcher\TemplateDispatcher'], |
|
38 | - 'isClosureAndTemplate' => ['JetFire\Routing\Dispatcher\ClosureDispatcher','JetFire\Routing\Dispatcher\TemplateDispatcher'], |
|
37 | + 'isControllerAndTemplate' => ['JetFire\Routing\Dispatcher\ControllerDispatcher', 'JetFire\Routing\Dispatcher\TemplateDispatcher'], |
|
38 | + 'isClosureAndTemplate' => ['JetFire\Routing\Dispatcher\ClosureDispatcher', 'JetFire\Routing\Dispatcher\TemplateDispatcher'], |
|
39 | 39 | ]; |
40 | 40 | |
41 | 41 | /** |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @param array $resolver |
51 | 51 | */ |
52 | - public function setResolver($resolver = []){ |
|
52 | + public function setResolver($resolver = []) { |
|
53 | 53 | $this->resolver = $resolver; |
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @param string $resolver |
58 | 58 | */ |
59 | - public function addResolver($resolver){ |
|
59 | + public function addResolver($resolver) { |
|
60 | 60 | $this->resolver[] = $resolver; |
61 | 61 | } |
62 | 62 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | /** |
72 | 72 | * @param array $dispatcher |
73 | 73 | */ |
74 | - public function setDispatcher($dispatcher = []){ |
|
74 | + public function setDispatcher($dispatcher = []) { |
|
75 | 75 | $this->dispatcher = $dispatcher; |
76 | 76 | } |
77 | 77 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return mixed|void |
82 | 82 | * @internal param array $dispatcher |
83 | 83 | */ |
84 | - public function addDispatcher($method,$class){ |
|
84 | + public function addDispatcher($method, $class) { |
|
85 | 85 | $this->dispatcher[$method] = $class; |
86 | 86 | } |
87 | 87 | |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | { |
93 | 93 | $this->request = []; |
94 | 94 | for ($i = 0; $i < $this->router->collection->countRoutes; ++$i) { |
95 | - $this->request['prefix'] = ($this->router->collection->getRoutes('prefix_' . $i) != '') ? $this->router->collection->getRoutes('prefix_' . $i) : ''; |
|
96 | - $this->request['subdomain'] = ($this->router->collection->getRoutes('subdomain_' . $i) != '') ? $this->router->collection->getRoutes('subdomain_' . $i) : ''; |
|
97 | - foreach ($this->router->collection->getRoutes('routes_' . $i) as $route => $params) { |
|
95 | + $this->request['prefix'] = ($this->router->collection->getRoutes('prefix_'.$i) != '') ? $this->router->collection->getRoutes('prefix_'.$i) : ''; |
|
96 | + $this->request['subdomain'] = ($this->router->collection->getRoutes('subdomain_'.$i) != '') ? $this->router->collection->getRoutes('subdomain_'.$i) : ''; |
|
97 | + foreach ($this->router->collection->getRoutes('routes_'.$i) as $route => $params) { |
|
98 | 98 | $this->request['params'] = $params; |
99 | 99 | $this->request['collection_index'] = $i; |
100 | - if($this->checkSubdomain($route)) { |
|
100 | + if ($this->checkSubdomain($route)) { |
|
101 | 101 | $route = strstr($route, '/'); |
102 | - $this->request['route'] = preg_replace_callback('#:([\w]+)#', [$this, 'paramMatch'], '/' . trim(trim($this->request['prefix'], '/') . '/' . trim($route, '/'), '/')); |
|
103 | - if ($this->routeMatch('#^' . $this->request['route'] . '$#')) { |
|
102 | + $this->request['route'] = preg_replace_callback('#:([\w]+)#', [$this, 'paramMatch'], '/'.trim(trim($this->request['prefix'], '/').'/'.trim($route, '/'), '/')); |
|
103 | + if ($this->routeMatch('#^'.$this->request['route'].'$#')) { |
|
104 | 104 | $this->setCallback(); |
105 | 105 | return $this->generateTarget(); |
106 | 106 | } |
@@ -114,17 +114,17 @@ discard block |
||
114 | 114 | * @param $route |
115 | 115 | * @return bool |
116 | 116 | */ |
117 | - private function checkSubdomain($route){ |
|
118 | - $url = (isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http') . '://' . ($host = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'])); |
|
117 | + private function checkSubdomain($route) { |
|
118 | + $url = (isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http').'://'.($host = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'])); |
|
119 | 119 | $domain = $this->router->collection->getDomain($url); |
120 | - if(!empty($this->request['subdomain']) && $route[0] == '/') $route = trim($this->request['subdomain'],'.').'.'.$domain.$route; |
|
121 | - if($route[0] == '/'){ |
|
120 | + if (!empty($this->request['subdomain']) && $route[0] == '/') $route = trim($this->request['subdomain'], '.').'.'.$domain.$route; |
|
121 | + if ($route[0] == '/') { |
|
122 | 122 | return ($host != $domain) ? false : true; |
123 | - }elseif($route[0] != '/' && $host != $domain){ |
|
123 | + }elseif ($route[0] != '/' && $host != $domain) { |
|
124 | 124 | $route = substr($route, 0, strpos($route, "/")); |
125 | 125 | $route = str_replace('{host}', $domain, $route); |
126 | 126 | $route = preg_replace_callback('#{subdomain}#', [$this, 'subdomainMatch'], $route); |
127 | - if (preg_match('#^' . $route . '$#', $host, $this->request['called_subdomain'])) { |
|
127 | + if (preg_match('#^'.$route.'$#', $host, $this->request['called_subdomain'])) { |
|
128 | 128 | $this->request['called_subdomain'] = array_shift($this->request['called_subdomain']); |
129 | 129 | return true; |
130 | 130 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | if (is_array($this->request['params']) && isset($this->request['params']['subdomain'])) { |
141 | 141 | $this->request['params']['subdomain'] = str_replace('(', '(?:', $this->request['params']['subdomain']); |
142 | - return '(' . $this->request['params']['subdomain'] . ')'; |
|
142 | + return '('.$this->request['params']['subdomain'].')'; |
|
143 | 143 | } |
144 | 144 | return '([^/]+)'; |
145 | 145 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | { |
153 | 153 | if (is_array($this->request['params']) && isset($this->request['params']['arguments'][$match[1]])) { |
154 | 154 | $this->request['params']['arguments'][$match[1]] = str_replace('(', '(?:', $this->request['params']['arguments'][$match[1]]); |
155 | - return '(' . $this->request['params']['arguments'][$match[1]] . ')'; |
|
155 | + return '('.$this->request['params']['arguments'][$match[1]].')'; |
|
156 | 156 | } |
157 | 157 | return '([^/]+)'; |
158 | 158 | } |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | */ |
181 | 181 | private function generateTarget() |
182 | 182 | { |
183 | - if($this->validMethod()) |
|
184 | - foreach($this->resolver as $resolver) |
|
185 | - if (is_array($target = call_user_func_array([$this,$resolver],[$this->router->route->getCallback()]))) { |
|
183 | + if ($this->validMethod()) |
|
184 | + foreach ($this->resolver as $resolver) |
|
185 | + if (is_array($target = call_user_func_array([$this, $resolver], [$this->router->route->getCallback()]))) { |
|
186 | 186 | $this->setTarget($target); |
187 | 187 | $this->router->response->setStatusCode(202); |
188 | 188 | return true; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | /** |
195 | 195 | * @param array $target |
196 | 196 | */ |
197 | - public function setTarget($target = []){ |
|
197 | + public function setTarget($target = []) { |
|
198 | 198 | $index = isset($this->request['collection_index']) ? $this->request['collection_index'] : 0; |
199 | 199 | $this->router->route->setDetail($this->request); |
200 | 200 | $this->router->route->setTarget($target); |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | /** |
206 | 206 | * |
207 | 207 | */ |
208 | - private function setCallback(){ |
|
208 | + private function setCallback() { |
|
209 | 209 | if (isset($this->request['params'])) { |
210 | - if(is_callable($this->request['params'])) |
|
210 | + if (is_callable($this->request['params'])) |
|
211 | 211 | $this->router->route->setCallback($this->request['params']); |
212 | 212 | else { |
213 | 213 | (is_array($this->request['params']) && isset($this->request['params']['use'])) |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function validMethod() |
226 | 226 | { |
227 | - if(is_callable($this->request['params']))return true; |
|
227 | + if (is_callable($this->request['params']))return true; |
|
228 | 228 | if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') |
229 | 229 | return (isset($this->request['params']['ajax']) && $this->request['params']['ajax'] === true) ? true : false; |
230 | 230 | $method = (isset($this->request['params']['method'])) ? $this->request['params']['method'] : ['GET']; |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | * @return array|bool |
237 | 237 | * @throws \Exception |
238 | 238 | */ |
239 | - public function isClosureAndTemplate($callback){ |
|
240 | - if(is_array($cls = $this->isClosure($callback))) { |
|
239 | + public function isClosureAndTemplate($callback) { |
|
240 | + if (is_array($cls = $this->isClosure($callback))) { |
|
241 | 241 | if (is_array($this->request['params']) && isset($this->request['params']['template']) && is_array($tpl = $this->isTemplate($this->request['params']['template']))) { |
242 | - return array_merge(array_merge($cls, $tpl),[ |
|
242 | + return array_merge(array_merge($cls, $tpl), [ |
|
243 | 243 | 'dispatcher' => $this->dispatcher['isClosureAndTemplate'] |
244 | 244 | ]); |
245 | 245 | } |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | * @return array|bool |
254 | 254 | * @throws \Exception |
255 | 255 | */ |
256 | - public function isControllerAndTemplate($callback){ |
|
257 | - if(is_array($ctrl = $this->isController($callback))) { |
|
256 | + public function isControllerAndTemplate($callback) { |
|
257 | + if (is_array($ctrl = $this->isController($callback))) { |
|
258 | 258 | if (is_array($this->request['params']) && isset($this->request['params']['template']) && is_array($tpl = $this->isTemplate($this->request['params']['template']))) { |
259 | - return array_merge(array_merge($ctrl, $tpl),[ |
|
259 | + return array_merge(array_merge($ctrl, $tpl), [ |
|
260 | 260 | 'dispatcher' => $this->dispatcher['isControllerAndTemplate'] |
261 | 261 | ]); |
262 | 262 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | ? $routes[0] |
297 | 297 | : $this->router->collection->getRoutes()['ctrl_namespace_'.$index].$routes[0]; |
298 | 298 | if (!class_exists($class)) |
299 | - throw new \Exception('Class "' . $class . '." is not found'); |
|
299 | + throw new \Exception('Class "'.$class.'." is not found'); |
|
300 | 300 | if (method_exists($class, $routes[1])) { |
301 | 301 | return [ |
302 | 302 | 'dispatcher' => $this->dispatcher['isController'], |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | 'action' => $routes[1] |
306 | 306 | ]; |
307 | 307 | } |
308 | - throw new \Exception('The required method "' . $routes[1] . '" is not found in "' . $class . '"'); |
|
308 | + throw new \Exception('The required method "'.$routes[1].'" is not found in "'.$class.'"'); |
|
309 | 309 | } |
310 | 310 | return false; |
311 | 311 | } |
@@ -317,25 +317,25 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public function isTemplate($callback) |
319 | 319 | { |
320 | - if(is_string($callback)) { |
|
320 | + if (is_string($callback)) { |
|
321 | 321 | $path = trim($callback, '/'); |
322 | 322 | $extension = substr(strrchr($path, "."), 1); |
323 | 323 | $index = isset($this->request['collection_index']) ? $this->request['collection_index'] : 0; |
324 | - $viewDir = $this->router->collection->getRoutes('view_dir_' . $index); |
|
324 | + $viewDir = $this->router->collection->getRoutes('view_dir_'.$index); |
|
325 | 325 | $target = null; |
326 | - if (in_array('.' . $extension, $this->router->getConfig()['templateExtension']) && (is_file($fullPath = $viewDir . $path) || is_file($fullPath = $path))) |
|
326 | + if (in_array('.'.$extension, $this->router->getConfig()['templateExtension']) && (is_file($fullPath = $viewDir.$path) || is_file($fullPath = $path))) |
|
327 | 327 | $target = $fullPath; |
328 | 328 | else { |
329 | 329 | foreach ($this->router->getConfig()['templateExtension'] as $ext) { |
330 | - if (is_file($fullPath = $viewDir . $path . $ext) || is_file($fullPath = $path . $ext)) { |
|
330 | + if (is_file($fullPath = $viewDir.$path.$ext) || is_file($fullPath = $path.$ext)) { |
|
331 | 331 | $target = $fullPath; |
332 | 332 | $extension = substr(strrchr($ext, "."), 1); |
333 | 333 | break; |
334 | 334 | } |
335 | 335 | } |
336 | 336 | } |
337 | - if(is_null($target)) |
|
338 | - throw new \Exception('Template file "' . $path . '" is not found in "' . $viewDir . '"'); |
|
337 | + if (is_null($target)) |
|
338 | + throw new \Exception('Template file "'.$path.'" is not found in "'.$viewDir.'"'); |
|
339 | 339 | return [ |
340 | 340 | 'dispatcher' => $this->dispatcher['isTemplate'], |
341 | 341 | 'template' => $target, |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | public function addRoutes($routes = null, $options = []) |
44 | 44 | { |
45 | 45 | if (!is_null($routes) && !is_array($routes)) { |
46 | - if (strpos($routes, '.php') === false) $routes = trim($routes, '/') . '/'; |
|
47 | - if (is_file($routes . '/routes.php') && is_array($routesFile = include $routes . '/routes.php')) $routes = $routesFile; |
|
46 | + if (strpos($routes, '.php') === false) $routes = trim($routes, '/').'/'; |
|
47 | + if (is_file($routes.'/routes.php') && is_array($routesFile = include $routes.'/routes.php')) $routes = $routesFile; |
|
48 | 48 | elseif (is_file($routes) && is_array($routesFile = include $routes)) $routes = $routesFile; |
49 | - else throw new \InvalidArgumentException('Argument for "' . get_called_class() . '" constructor is not recognized. Expected argument array or file containing array but "' . $routes . '" given'); |
|
49 | + else throw new \InvalidArgumentException('Argument for "'.get_called_class().'" constructor is not recognized. Expected argument array or file containing array but "'.$routes.'" given'); |
|
50 | 50 | } |
51 | - $this->routes['routes_' . $this->countRoutes] = is_array($routes) ? $routes : []; |
|
51 | + $this->routes['routes_'.$this->countRoutes] = is_array($routes) ? $routes : []; |
|
52 | 52 | $this->setRoutes($options, $this->countRoutes); |
53 | 53 | $this->countRoutes++; |
54 | 54 | } |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | if (is_array($args)) { |
73 | 73 | $nbrArgs = count($args); |
74 | 74 | for ($i = 0; $i < $nbrArgs; ++$i) |
75 | - $this->routes['prefix_' . $i] = '/' . trim($args[$i], '/'); |
|
75 | + $this->routes['prefix_'.$i] = '/'.trim($args[$i], '/'); |
|
76 | 76 | } elseif (is_string($args)) |
77 | 77 | for ($i = 0; $i < $this->countRoutes; ++$i) |
78 | - $this->routes['prefix_' . $i] = '/' . trim($args, '/'); |
|
78 | + $this->routes['prefix_'.$i] = '/'.trim($args, '/'); |
|
79 | 79 | if ($this->countRoutes == 0) $this->countRoutes++; |
80 | 80 | } |
81 | 81 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | for ($i = 0; $i < $nbrArgs; ++$i) { |
89 | 89 | if (is_array($args[$i])) { |
90 | 90 | $this->setRoutes($args[$i], $i); |
91 | - if (!isset($this->routes['routes_' . $i])) $this->routes['routes_' . $i] = []; |
|
91 | + if (!isset($this->routes['routes_'.$i])) $this->routes['routes_'.$i] = []; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | if ($this->countRoutes == 0) $this->countRoutes++; |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private function setRoutes($args = [], $i) |
102 | 102 | { |
103 | - $this->routes['block_' . $i] = (isset($args['block']) && !empty($args['block'])) ? rtrim($args['block'], '/') . '/' : ''; |
|
104 | - $this->routes['view_dir_' . $i] = (isset($args['view_dir']) && !empty($args['view_dir'])) ? rtrim($args['view_dir'], '/') . '/' : ''; |
|
105 | - $this->routes['ctrl_namespace_' . $i] = (isset($args['ctrl_namespace']) && !empty($args['ctrl_namespace'])) ? trim($args['ctrl_namespace'], '\\') . '\\' : ''; |
|
106 | - $this->routes['prefix_' . $i] = (isset($args['prefix']) && !empty($args['prefix'])) ? '/' . trim($args['prefix'], '/') : ''; |
|
107 | - $this->routes['subdomain_' . $i] = (isset($args['subdomain'])) ? $args['subdomain'] : ''; |
|
103 | + $this->routes['block_'.$i] = (isset($args['block']) && !empty($args['block'])) ? rtrim($args['block'], '/').'/' : ''; |
|
104 | + $this->routes['view_dir_'.$i] = (isset($args['view_dir']) && !empty($args['view_dir'])) ? rtrim($args['view_dir'], '/').'/' : ''; |
|
105 | + $this->routes['ctrl_namespace_'.$i] = (isset($args['ctrl_namespace']) && !empty($args['ctrl_namespace'])) ? trim($args['ctrl_namespace'], '\\').'\\' : ''; |
|
106 | + $this->routes['prefix_'.$i] = (isset($args['prefix']) && !empty($args['prefix'])) ? '/'.trim($args['prefix'], '/') : ''; |
|
107 | + $this->routes['subdomain_'.$i] = (isset($args['subdomain'])) ? $args['subdomain'] : ''; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -126,24 +126,24 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function generateRoutesPath() |
128 | 128 | { |
129 | - $root = (isset($_SERVER['REQUEST_SCHEME'])?$_SERVER['REQUEST_SCHEME']:'http') . '://' . ($domain = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'])) . str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']); |
|
129 | + $root = (isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http').'://'.($domain = (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'])).str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']); |
|
130 | 130 | if (strpos($domain, ($new_domain = $this->getDomain($root))) !== false) |
131 | 131 | $root = str_replace($domain, $new_domain, $root); |
132 | 132 | $count = 0; |
133 | 133 | for ($i = 0; $i < $this->countRoutes; ++$i) { |
134 | - $prefix = (isset($this->routes['prefix_' . $i])) ? $this->routes['prefix_' . $i] : ''; |
|
135 | - if (isset($this->routes['routes_' . $i])) |
|
136 | - foreach ($this->routes['routes_' . $i] as $route => $dependencies) { |
|
134 | + $prefix = (isset($this->routes['prefix_'.$i])) ? $this->routes['prefix_'.$i] : ''; |
|
135 | + if (isset($this->routes['routes_'.$i])) |
|
136 | + foreach ($this->routes['routes_'.$i] as $route => $dependencies) { |
|
137 | 137 | if (is_array($dependencies) && isset($dependencies['use'])) |
138 | - $use = (is_callable($dependencies['use'])) ? 'closure-' . $count : trim($dependencies['use'], '/'); |
|
138 | + $use = (is_callable($dependencies['use'])) ? 'closure-'.$count : trim($dependencies['use'], '/'); |
|
139 | 139 | elseif (!is_array($dependencies)) |
140 | - $use = (is_callable($dependencies)) ? 'closure-' . $count : trim($dependencies, '/'); |
|
140 | + $use = (is_callable($dependencies)) ? 'closure-'.$count : trim($dependencies, '/'); |
|
141 | 141 | else |
142 | 142 | $use = $route; |
143 | 143 | if (isset($route[0]) && $route[0] == '/') { |
144 | - (!is_callable($dependencies) && isset($dependencies['name'])) ? $this->routesByName[$use . '#' . $dependencies['name']] = $root . $prefix . $route : $this->routesByName[$use] = $root . $prefix . $route; |
|
144 | + (!is_callable($dependencies) && isset($dependencies['name'])) ? $this->routesByName[$use.'#'.$dependencies['name']] = $root.$prefix.$route : $this->routesByName[$use] = $root.$prefix.$route; |
|
145 | 145 | } else { |
146 | - (!is_callable($dependencies) && isset($dependencies['name'])) ? $this->routesByName[$use . '#' . $dependencies['name']] = $_SERVER['REQUEST_SCHEME'] . '://' . str_replace('{host}', $new_domain, $route) . $prefix : $this->routesByName[$use] = $_SERVER['REQUEST_SCHEME'] . '://' . str_replace('{host}', $new_domain, $route) . $prefix; |
|
146 | + (!is_callable($dependencies) && isset($dependencies['name'])) ? $this->routesByName[$use.'#'.$dependencies['name']] = $_SERVER['REQUEST_SCHEME'].'://'.str_replace('{host}', $new_domain, $route).$prefix : $this->routesByName[$use] = $_SERVER['REQUEST_SCHEME'].'://'.str_replace('{host}', $new_domain, $route).$prefix; |
|
147 | 147 | } |
148 | 148 | $count++; |
149 | 149 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | foreach ($this->routesByName as $key => $route) { |
177 | 177 | $param = explode('#', $key); |
178 | 178 | $route = str_replace('{subdomain}', $subdomain, $route); |
179 | - foreach ($params as $key2 => $value) $route = str_replace(':' . $key2, $value, $route); |
|
179 | + foreach ($params as $key2 => $value) $route = str_replace(':'.$key2, $value, $route); |
|
180 | 180 | if ($param[0] == trim($name, '/')) return $route; |
181 | 181 | else if (isset($param[1]) && $param[1] == $name) return $route; |
182 | 182 | } |