@@ -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 | /** |