111
This commit is contained in:
@@ -29,6 +29,17 @@ abstract class Handler implements RequestHandlerInterface
|
||||
protected ?array $middlewares;
|
||||
|
||||
|
||||
/**
|
||||
* @param \Http\Handler\Handler $handler
|
||||
* @param array|null $middlewares
|
||||
*/
|
||||
public function __construct(CHl $handler, ?array $middlewares)
|
||||
{
|
||||
$this->handler = $handler;
|
||||
$this->middlewares = $middlewares;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \Kiri\Proxy\AspectProxy $aspectProxy
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace Server\Abstracts;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -13,7 +15,7 @@ class PageNotFoundException extends \Exception
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct(int $code)
|
||||
#[Pure] public function __construct(int $code)
|
||||
{
|
||||
parent::__construct('<h2>HTTP 404 Not Found</h2><hr><i>Powered by Swoole</i>', $code);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect
|
||||
{
|
||||
$middlewares = MiddlewareManager::get($handler->callback);
|
||||
|
||||
$dispatcher = $this->dispatcher->setHandler($handler)->setMiddlewares($middlewares);
|
||||
$dispatcher = new Dispatcher($handler, $middlewares);
|
||||
|
||||
return $dispatcher->handle($PsrRequest);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user