1 | <?php |
||
14 | class Router |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var array Routes |
||
19 | */ |
||
20 | protected $routes = []; |
||
21 | |||
22 | /** |
||
23 | * Connects a new route in the router |
||
24 | * |
||
25 | * @param string $route Route |
||
26 | * @param string $controller Controller |
||
27 | * @param string $action Action |
||
28 | * |
||
29 | * @throws RouteAlreadyConnectedException When route is already connected |
||
30 | */ |
||
31 | 3 | public function connect(string $route, string $controller, string $action) |
|
42 | |||
43 | /** |
||
44 | * Route to get controller and action |
||
45 | * |
||
46 | * @param string $route Route |
||
47 | * |
||
48 | * @return array Controller and action |
||
49 | * |
||
50 | * @throws RouteNonexistentException When route is not connected |
||
51 | */ |
||
52 | 3 | public function route(string $route): array |
|
69 | } |
||
70 |