变更
This commit is contained in:
@@ -35,8 +35,6 @@ class Delete extends AbstractRequestMethod implements InjectRouteInterface
|
|||||||
{
|
{
|
||||||
// TODO: Implement dispatch() method.
|
// TODO: Implement dispatch() method.
|
||||||
Router::addRoute(RequestMethod::REQUEST_DELETE, $this->path, [$class, $method]);
|
Router::addRoute(RequestMethod::REQUEST_DELETE, $this->path, [$class, $method]);
|
||||||
|
|
||||||
$this->registerMiddleware($class, $method);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Kiri\Router\Annotate;
|
|
||||||
|
|
||||||
|
|
||||||
#[\Attribute(\Attribute::TARGET_METHOD)]
|
|
||||||
class Filter
|
|
||||||
{
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -36,8 +36,6 @@ class Get extends AbstractRequestMethod implements InjectRouteInterface
|
|||||||
{
|
{
|
||||||
// TODO: Implement dispatch() method.
|
// TODO: Implement dispatch() method.
|
||||||
Router::addRoute(RequestMethod::REQUEST_GET, $this->path, [$class, $method]);
|
Router::addRoute(RequestMethod::REQUEST_GET, $this->path, [$class, $method]);
|
||||||
|
|
||||||
$this->registerMiddleware($class, $method);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
namespace Kiri\Router\Annotate;
|
namespace Kiri\Router\Annotate;
|
||||||
|
|
||||||
use Kiri\Di\Interface\InjectPropertyInterface;
|
use Kiri\Di\Interface\InjectPropertyInterface;
|
||||||
|
use Kiri\Router\Base\Middleware as MiddlewareManager;
|
||||||
|
|
||||||
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
|
||||||
class Middleware implements InjectPropertyInterface
|
class Middleware implements InjectPropertyInterface
|
||||||
@@ -21,9 +22,13 @@ class Middleware implements InjectPropertyInterface
|
|||||||
* @param object $class
|
* @param object $class
|
||||||
* @param string $property
|
* @param string $property
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function dispatch(object $class, string $property): void
|
public function dispatch(object $class, string $property): void
|
||||||
{
|
{
|
||||||
|
$middlewareManager = \Kiri::getDi()->get(MiddlewareManager::class);
|
||||||
|
|
||||||
|
$middlewareManager->set($class::class, $property, $this->middleware);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ class Options extends AbstractRequestMethod implements InjectRouteInterface
|
|||||||
{
|
{
|
||||||
// TODO: Implement dispatch() method.
|
// TODO: Implement dispatch() method.
|
||||||
Router::addRoute(RequestMethod::REQUEST_OPTIONS, $this->path, [$class, $method]);
|
Router::addRoute(RequestMethod::REQUEST_OPTIONS, $this->path, [$class, $method]);
|
||||||
|
|
||||||
$this->registerMiddleware($class, $method);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Kiri\Router\Annotate;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Kiri\Router\Interface\InjectRouteInterface;
|
|
||||||
use Kiri\Router\Router;
|
|
||||||
use ReflectionException;
|
|
||||||
|
|
||||||
#[\Attribute(\Attribute::TARGET_METHOD)]
|
|
||||||
class Other extends AbstractRequestMethod implements InjectRouteInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $method
|
|
||||||
* @param string $path
|
|
||||||
* @param string $formValidate
|
|
||||||
*/
|
|
||||||
public function __construct(readonly public string $method, string $path, string $formValidate = '')
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param object $class
|
|
||||||
* @param string $method
|
|
||||||
* @return void
|
|
||||||
* @throws ReflectionException
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function dispatch(object $class, string $method): void
|
|
||||||
{
|
|
||||||
// TODO: Implement dispatch() method.
|
|
||||||
Router::addRoute([$this->method], $this->path, [$class, $method]);
|
|
||||||
|
|
||||||
$this->registerMiddleware($class, $method);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -35,8 +35,6 @@ class Post extends AbstractRequestMethod implements InjectRouteInterface
|
|||||||
{
|
{
|
||||||
// TODO: Implement dispatch() method.
|
// TODO: Implement dispatch() method.
|
||||||
Router::addRoute(RequestMethod::REQUEST_POST, $this->path, [$class, $method]);
|
Router::addRoute(RequestMethod::REQUEST_POST, $this->path, [$class, $method]);
|
||||||
|
|
||||||
$this->registerMiddleware($class, $method);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ class Put extends AbstractRequestMethod implements InjectRouteInterface
|
|||||||
{
|
{
|
||||||
// TODO: Implement dispatch() method.
|
// TODO: Implement dispatch() method.
|
||||||
Router::addRoute(RequestMethod::REQUEST_PUT, $this->path, [$class, $method]);
|
Router::addRoute(RequestMethod::REQUEST_PUT, $this->path, [$class, $method]);
|
||||||
|
|
||||||
$this->registerMiddleware($class, $method);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,5 @@ class Route extends AbstractRequestMethod implements InjectRouteInterface
|
|||||||
{
|
{
|
||||||
// TODO: Implement dispatch() method.
|
// TODO: Implement dispatch() method.
|
||||||
Router::addRoute($this->method, $this->path, [$class, $method]);
|
Router::addRoute($this->method, $this->path, [$class, $method]);
|
||||||
|
|
||||||
$this->registerMiddleware($class, $method);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user