Files
zhamao-framework/src/ZM/Plugin/Traits/RouteTrait.php
2023-01-12 09:45:01 +08:00

32 lines
508 B
PHP

<?php
declare(strict_types=1);
namespace ZM\Plugin\Traits;
use ZM\Annotation\Http\Route;
trait RouteTrait
{
/** @var array 注册的路由列表 */
protected array $routes = [];
/**
* 添加一个 HTTP 路由
*
* @param Route $route Route 注解对象
*/
public function addHttpRoute(Route $route): void
{
$this->routes[] = $route;
}
/**
* @internal
*/
public function getRoutes(): array
{
return $this->routes;
}
}