改名
This commit is contained in:
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace Http\Handler\Abstracts;
|
||||
|
||||
use Http\Handler\Handler as CHl;
|
||||
use Kiri\Kiri;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Http\Handler\Handler as CHl;
|
||||
|
||||
|
||||
abstract class Handler implements RequestHandlerInterface
|
||||
@@ -33,7 +34,11 @@ abstract class Handler implements RequestHandlerInterface
|
||||
protected function execute(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
if (empty($this->middlewares) || !isset($this->middlewares[$this->offset])) {
|
||||
return call_user_func($this->handler->callback, ...$this->handler->params);
|
||||
[$controller, $action] = $this->handler->callback;
|
||||
|
||||
$controller = Kiri::getDi()->get($controller);
|
||||
|
||||
return call_user_func([$controller, $action], ...$this->handler->params);
|
||||
}
|
||||
|
||||
$middleware = $this->middlewares[$this->offset];
|
||||
|
||||
@@ -13,11 +13,11 @@ class HandlerManager
|
||||
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
* @param $method
|
||||
* @param $handler
|
||||
* @param string $path
|
||||
* @param string $method
|
||||
* @param \Http\Handler\Handler|Closure $handler
|
||||
*/
|
||||
public static function add($path, $method, $handler)
|
||||
public static function add(string $path, string $method, \Http\Handler\Handler|Closure $handler)
|
||||
{
|
||||
if (!isset(static::$handlers[$path])) {
|
||||
static::$handlers[$path] = [];
|
||||
|
||||
Reference in New Issue
Block a user