1 | <?php |
||
12 | class Routes implements RoutesInterface |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * List of added routes. |
||
17 | * @var array |
||
18 | */ |
||
19 | public $routes = []; |
||
20 | |||
21 | private $groupedRoute = false; |
||
22 | |||
23 | private $dir = []; |
||
24 | |||
25 | |||
26 | /** |
||
27 | * Add group of routes |
||
28 | * @param string $path |
||
29 | * @param callable $routeCallback |
||
30 | * @return void |
||
31 | */ |
||
32 | public function group($path = '', callable $routeCallback) |
||
39 | |||
40 | /** |
||
41 | * Add Route to Application. |
||
42 | * @param array|string $method |
||
43 | * @param string $pattern |
||
44 | * @param RouteHandlerInterface $handler |
||
45 | * @param array $name |
||
46 | * @throws \Exception |
||
47 | */ |
||
48 | public function add($method, $pattern, RouteHandlerInterface $handler, array $name = ['global']) |
||
75 | |||
76 | /** |
||
77 | * Current added routes |
||
78 | * @return array |
||
79 | */ |
||
80 | public function getRoutes() |
||
84 | |||
85 | /** |
||
86 | * Check that the Route is unique before adding it (again). |
||
87 | * @param $method |
||
88 | * @param $pattern |
||
89 | * @return bool |
||
90 | * @throws \Exception |
||
91 | */ |
||
92 | public function isUnique($method, $pattern) |
||
101 | } |
||
102 |