| Total Complexity | 6 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class GroupRoutes |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * 名称查找器 |
||
| 17 | * |
||
| 18 | * @var NameFinder |
||
| 19 | */ |
||
| 20 | protected $finder; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * 路由集合 |
||
| 24 | * |
||
| 25 | * @var RouteCollection[] |
||
| 26 | */ |
||
| 27 | protected $routes = []; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * 默认分组 |
||
| 31 | * |
||
| 32 | * @var string |
||
| 33 | */ |
||
| 34 | protected $default = 'global:'; |
||
| 35 | |||
| 36 | public function __construct(NameFinder $finder) { |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * 注册路由 |
||
| 42 | * |
||
| 43 | * @param string|null $group |
||
| 44 | * @param RouteMatcher $router |
||
| 45 | * @return void |
||
| 46 | */ |
||
| 47 | public function add(?string $group = null, string $name, RouteMatcher $router) |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * 搜索路由 |
||
| 59 | * |
||
| 60 | * @param string $name |
||
| 61 | * @return RouteMatcher|null |
||
| 62 | */ |
||
| 63 | public function find(string $name, ?string $default = null):?RouteMatcher |
||
| 72 |