separate ZMPlugin to traits

This commit is contained in:
crazywhalecc
2023-01-12 09:39:52 +08:00
parent a420c3ab23
commit dd6b700b47
11 changed files with 211 additions and 71 deletions

View File

@@ -0,0 +1,30 @@
<?php
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;
}
}