111
This commit is contained in:
@@ -6,6 +6,7 @@ use Http\Handler\Handler as CHl;
|
||||
use Http\Message\ServerRequest;
|
||||
use Kiri\Core\Help;
|
||||
use Kiri\Kiri;
|
||||
use Kiri\Proxy\AspectProxy;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
@@ -74,16 +75,8 @@ abstract class Handler implements RequestHandlerInterface
|
||||
*/
|
||||
protected function dispatcher(ServerRequestInterface $request): mixed
|
||||
{
|
||||
if ($this->handler->callback instanceof \Closure) {
|
||||
$response = call_user_func($this->handler->callback, ...$this->handler->params);
|
||||
} else {
|
||||
[$controller, $action] = $this->handler->callback;
|
||||
|
||||
$controller = Kiri::getDi()->get($controller);
|
||||
|
||||
$response = call_user_func([$controller, $action], ...$this->handler->params);
|
||||
}
|
||||
if (!($response instanceof ResponseInterface)) {
|
||||
$aspect = Kiri::getDi()->get(AspectProxy::class);
|
||||
if (!(($response = $aspect->proxy($this->handler)) instanceof ResponseInterface)) {
|
||||
$response = $this->transferToResponse($response);
|
||||
}
|
||||
$response->withHeader('Run-Time', $this->_runTime($request));
|
||||
|
||||
@@ -106,8 +106,7 @@ class Pipeline
|
||||
* @param $destination
|
||||
* @param $parameters
|
||||
* @return Closure|array
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
*/
|
||||
private function aspect_caller($destination, $parameters): Closure|array
|
||||
{
|
||||
[$controller, $action] = $destination;
|
||||
|
||||
@@ -212,7 +212,7 @@ class Router
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function _loader()
|
||||
public function read_files()
|
||||
{
|
||||
$this->loadRouteDir(APP_PATH . 'routes');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user