eee
This commit is contained in:
@@ -5,6 +5,8 @@ namespace Kiri\Router;
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
use ReflectionMethod;
|
use ReflectionMethod;
|
||||||
@@ -18,6 +20,8 @@ class ControllerInterpreter
|
|||||||
* @param string|ReflectionMethod $method
|
* @param string|ReflectionMethod $method
|
||||||
* @param ReflectionClass|null $reflection
|
* @param ReflectionClass|null $reflection
|
||||||
* @return Handler
|
* @return Handler
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function addRouteByString(object $class, string|ReflectionMethod $method, ?ReflectionClass $reflection = null): Handler
|
public function addRouteByString(object $class, string|ReflectionMethod $method, ?ReflectionClass $reflection = null): Handler
|
||||||
@@ -33,7 +37,8 @@ class ControllerInterpreter
|
|||||||
* @param Closure $method
|
* @param Closure $method
|
||||||
* @return Handler
|
* @return Handler
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws Exception
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function addRouteByClosure(Closure $method): Handler
|
public function addRouteByClosure(Closure $method): Handler
|
||||||
{
|
{
|
||||||
@@ -50,6 +55,8 @@ class ControllerInterpreter
|
|||||||
* @param string|ReflectionMethod $method
|
* @param string|ReflectionMethod $method
|
||||||
* @param ReflectionClass|null $reflection
|
* @param ReflectionClass|null $reflection
|
||||||
* @return Handler
|
* @return Handler
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function addRouteByObject(object $class, string|ReflectionMethod $method, ?ReflectionClass $reflection = null): Handler
|
public function addRouteByObject(object $class, string|ReflectionMethod $method, ?ReflectionClass $reflection = null): Handler
|
||||||
@@ -67,6 +74,8 @@ class ControllerInterpreter
|
|||||||
* @param ReflectionClass $reflectionClass
|
* @param ReflectionClass $reflectionClass
|
||||||
* @return Handler
|
* @return Handler
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function resolveMethod(object $class, string|\ReflectionMethod $reflectionMethod, ReflectionClass $reflectionClass): Handler
|
public function resolveMethod(object $class, string|\ReflectionMethod $reflectionMethod, ReflectionClass $reflectionClass): Handler
|
||||||
|
|||||||
+1
-5
@@ -37,14 +37,13 @@ class Handler implements RequestHandlerInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|Closure $handler
|
* @param array|Closure $handler
|
||||||
* @param string $method
|
|
||||||
* @param array $parameter
|
* @param array $parameter
|
||||||
* @param ReflectionNamedType|null $reflectionType
|
* @param ReflectionNamedType|null $reflectionType
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
* @throws NotFoundExceptionInterface
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function __construct(public array|Closure $handler, string $method, public array $parameter, public ?ReflectionNamedType $reflectionType)
|
public function __construct(public array|Closure $handler, public array $parameter, public ?ReflectionNamedType $reflectionType)
|
||||||
{
|
{
|
||||||
$this->container = \Kiri::getDi();
|
$this->container = \Kiri::getDi();
|
||||||
if ($this->reflectionType != null) {
|
if ($this->reflectionType != null) {
|
||||||
@@ -52,9 +51,6 @@ class Handler implements RequestHandlerInterface
|
|||||||
} else {
|
} else {
|
||||||
$this->format = $this->container->get(MixedFormat::class);
|
$this->format = $this->container->get(MixedFormat::class);
|
||||||
}
|
}
|
||||||
if ($method === 'HEAD') {
|
|
||||||
$this->format = $this->container->get(NoBody::class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user