1 | <?php |
||
28 | class RouterLayer extends AbstractContainerAccessor implements InboundLayerInterface |
||
29 | { |
||
30 | /** |
||
31 | * The routes managed by this Router. |
||
32 | * |
||
33 | * @var \Veto\Collection\Bag |
||
34 | */ |
||
35 | protected $routes; |
||
36 | |||
37 | /** |
||
38 | * The event dispatcher. |
||
39 | * |
||
40 | * @var \Veto\Event\Dispatcher |
||
41 | */ |
||
42 | protected $dispatcher; |
||
43 | |||
44 | /** |
||
45 | * Initialise the router, optionally from configuration |
||
46 | * |
||
47 | * @param Hive $config |
||
48 | * @param Dispatcher $dispatcher |
||
49 | * @throws ConfigurationException |
||
50 | */ |
||
51 | public function __construct(Hive $config = null, Dispatcher $dispatcher = null) |
||
69 | |||
70 | /** |
||
71 | * Add a route with an arbitrary method to the router. |
||
72 | * |
||
73 | * @param $name |
||
74 | * @param $pattern |
||
75 | * @param string[] $rules |
||
76 | * @param string[] $methods |
||
77 | * @param $controller |
||
78 | * @param $action |
||
79 | */ |
||
80 | public function addRoute($name, $pattern, array $rules, $methods = array('GET'), $controller, $action) |
||
84 | |||
85 | /** |
||
86 | * Tag a request $request with a controller so that the kernel (Veto\App) |
||
87 | * can dispatch it to a controller. |
||
88 | * |
||
89 | * @param Request $request |
||
90 | * @return Request |
||
91 | * @throws \Exception |
||
92 | */ |
||
93 | public function in(Request $request) |
||
133 | |||
134 | /** |
||
135 | * Generate a URL from a route name and paramters. |
||
136 | * |
||
137 | * @param string $routeName |
||
138 | * @param array $parameters |
||
139 | * @return string |
||
140 | * @throws \Exception |
||
141 | */ |
||
142 | public function generateUrl($routeName, array $parameters = array()) |
||
152 | } |
||
153 |