@@ -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,37 +214,37 @@ |
||
| 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 | - $patternKey = md5($options['pattern'] . '-' . $options['name']); |
|
| 228 | + $patternKey = md5($options['pattern'] . '-' . $options['name']); |
|
| 229 | 229 | |
| 230 | - if (isset($this->_pattern[$scheme][$host][$patternKey])) { |
|
| 231 | - $route = $this->_pattern[$scheme][$host][$patternKey]; |
|
| 232 | - } else { |
|
| 233 | - $this->_hosts[$scheme][$host] = $route->getHost(); |
|
| 234 | - } |
|
| 230 | + if (isset($this->_pattern[$scheme][$host][$patternKey])) { |
|
| 231 | + $route = $this->_pattern[$scheme][$host][$patternKey]; |
|
| 232 | + } else { |
|
| 233 | + $this->_hosts[$scheme][$host] = $route->getHost(); |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - if (!isset($this->_pattern[$scheme][$host][$patternKey])) { |
|
| 237 | - $this->_pattern[$scheme][$host][$patternKey] = $route; |
|
| 238 | - } |
|
| 236 | + if (!isset($this->_pattern[$scheme][$host][$patternKey])) { |
|
| 237 | + $this->_pattern[$scheme][$host][$patternKey] = $route; |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - $methods = $route->getMethods(); |
|
| 241 | - foreach ($methods as $method) { |
|
| 242 | - $this->_routes[$scheme][$host][strtoupper($method)][] = $route; |
|
| 243 | - } |
|
| 240 | + $methods = $route->getMethods(); |
|
| 241 | + foreach ($methods as $method) { |
|
| 242 | + $this->_routes[$scheme][$host][strtoupper($method)][] = $route; |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | - $this->_data[$route->getName()] = $route; |
|
| 245 | + $this->_data[$route->getName()] = $route; |
|
| 246 | 246 | |
| 247 | - return $this; |
|
| 247 | + return $this; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |