@@ -80,16 +80,16 @@ |
||
80 | 80 | public function match($request, &$variables = null, &$hostVariables = null): bool; |
81 | 81 | |
82 | 82 | /** |
83 | - * Returns the route's link. |
|
84 | - * |
|
85 | - * @param array $params The route parameters. |
|
86 | - * @param array $options Options for generating the proper prefix. Accepted values are: |
|
87 | - * - `'absolute'` _boolean_: `true` or `false`. - `'scheme'` |
|
88 | - * _string_ : The scheme. - `'host'` _string_ : The host |
|
89 | - * name. - `'basePath'` _string_ : The base path. - `'query'` |
|
90 | - * _string_ : The query string. - `'fragment'` _string_ : The |
|
91 | - * fragment string. |
|
92 | - * @return string The link. |
|
93 | - */ |
|
94 | - public function link(array $params = [], array $options = []): string; |
|
83 | + * Returns the route's link. |
|
84 | + * |
|
85 | + * @param array $params The route parameters. |
|
86 | + * @param array $options Options for generating the proper prefix. Accepted values are: |
|
87 | + * - `'absolute'` _boolean_: `true` or `false`. - `'scheme'` |
|
88 | + * _string_ : The scheme. - `'host'` _string_ : The host |
|
89 | + * name. - `'basePath'` _string_ : The base path. - `'query'` |
|
90 | + * _string_ : The query string. - `'fragment'` _string_ : The |
|
91 | + * fragment string. |
|
92 | + * @return string The link. |
|
93 | + */ |
|
94 | + public function link(array $params = [], array $options = []): string; |
|
95 | 95 | } |
@@ -214,35 +214,35 @@ |
||
214 | 214 | * @return \Lead\Router\RouterInterface |
215 | 215 | */ |
216 | 216 | public function addRoute(RouteInterface $route): RouterInterface { |
217 | - $options['pattern'] = $pattern = $route->getPattern(); |
|
218 | - $options['handler'] = $route->getHandler(); |
|
219 | - $options['scope'] = $route->getScope(); |
|
217 | + $options['pattern'] = $pattern = $route->getPattern(); |
|
218 | + $options['handler'] = $route->getHandler(); |
|
219 | + $options['scope'] = $route->getScope(); |
|
220 | 220 | |
221 | - $scheme = $options['scheme']; |
|
222 | - $host = $options['host']; |
|
221 | + $scheme = $options['scheme']; |
|
222 | + $host = $options['host']; |
|
223 | 223 | |
224 | - if (isset($this->_hosts[$scheme][$host])) { |
|
225 | - $options['host'] = $this->_hosts[$scheme][$host]; |
|
226 | - } |
|
224 | + if (isset($this->_hosts[$scheme][$host])) { |
|
225 | + $options['host'] = $this->_hosts[$scheme][$host]; |
|
226 | + } |
|
227 | 227 | |
228 | - if (isset($this->_pattern[$scheme][$host][$pattern])) { |
|
229 | - $route = $this->_pattern[$scheme][$host][$pattern]; |
|
230 | - } else { |
|
231 | - $this->_hosts[$scheme][$host] = $route->getHost(); |
|
232 | - } |
|
228 | + if (isset($this->_pattern[$scheme][$host][$pattern])) { |
|
229 | + $route = $this->_pattern[$scheme][$host][$pattern]; |
|
230 | + } else { |
|
231 | + $this->_hosts[$scheme][$host] = $route->getHost(); |
|
232 | + } |
|
233 | 233 | |
234 | - if (!isset($this->_pattern[$scheme][$host][$pattern])) { |
|
235 | - $this->_pattern[$scheme][$host][$pattern] = $route; |
|
236 | - } |
|
234 | + if (!isset($this->_pattern[$scheme][$host][$pattern])) { |
|
235 | + $this->_pattern[$scheme][$host][$pattern] = $route; |
|
236 | + } |
|
237 | 237 | |
238 | - $methods = $route->getMethods(); |
|
239 | - foreach ($methods as $method) { |
|
240 | - $this->_routes[$scheme][$host][strtoupper($method)][] = $route; |
|
241 | - } |
|
238 | + $methods = $route->getMethods(); |
|
239 | + foreach ($methods as $method) { |
|
240 | + $this->_routes[$scheme][$host][strtoupper($method)][] = $route; |
|
241 | + } |
|
242 | 242 | |
243 | - $this->_data[$route->getName()] = $route; |
|
243 | + $this->_data[$route->getName()] = $route; |
|
244 | 244 | |
245 | - return $this; |
|
245 | + return $this; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |