eee
This commit is contained in:
+1
-1
@@ -196,7 +196,7 @@ class Router
|
||||
foreach ($router->getMethods() as $name => $method) {
|
||||
$middlewares = $middleware->get($method->getClass(), $method->getMethod());
|
||||
|
||||
$router->setMethod($name, new HttpRequestHandler($middlewares, $method));
|
||||
$router->setHttpHandler($name, new HttpRequestHandler($middlewares, $method));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,12 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
|
||||
private array $methods = [];
|
||||
|
||||
|
||||
/**
|
||||
* @var array<string, HttpRequestHandler>
|
||||
*/
|
||||
protected array $httpHandler = [];
|
||||
|
||||
|
||||
/**
|
||||
* @var Handler
|
||||
*/
|
||||
@@ -80,9 +86,9 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
|
||||
* @param HttpRequestHandler $handler
|
||||
* @return void
|
||||
*/
|
||||
public function setMethod(string $method, HttpRequestHandler $handler): void
|
||||
public function setHttpHandler(string $method, HttpRequestHandler $handler): void
|
||||
{
|
||||
$this->methods[$method] = $handler;
|
||||
$this->httpHandler[$method] = $handler;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +243,7 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
|
||||
*/
|
||||
public function query(string $path, string $method): HttpRequestHandler
|
||||
{
|
||||
return $this->methods[$method . '_' . $path] ?? new HttpRequestHandler([], $this->found);
|
||||
return $this->httpHandler[$method . '_' . $path] ?? new HttpRequestHandler([], $this->found);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user