Files
kiri-router/src/Annotate/Delete.php
T
2023-04-17 14:00:53 +08:00

42 lines
798 B
PHP

<?php
declare(strict_types=1);
namespace Kiri\Router\Annotate;
use Exception;
use Kiri\Router\Constrict\RequestMethod;
use Kiri\Router\Interface\InjectRouteInterface;
use Kiri\Router\Router;
use ReflectionException;
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Delete extends AbstractRequestMethod implements InjectRouteInterface
{
/**
* @param string $path
*/
public function __construct(readonly public string $path)
{
}
/**
* @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(RequestMethod::REQUEST_DELETE, $this->path, [$class, $method]);
}
}