1 | <?php |
||
26 | class AuraRouterWrapper implements RouterInterface, RequestMatcherInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var AuraRouter |
||
30 | */ |
||
31 | protected $router; |
||
32 | |||
33 | /** |
||
34 | * @var @todo typehint this |
||
35 | */ |
||
36 | protected $context; |
||
37 | |||
38 | /** |
||
39 | * @param AuraRouter $router |
||
40 | */ |
||
41 | public function __construct(AuraRouter $router) |
||
45 | |||
46 | /** |
||
47 | * @param AuraRouter $router |
||
48 | */ |
||
49 | public function setRouter(AuraRouter $router) |
||
53 | |||
54 | /** |
||
55 | * @param RequestContext $context |
||
56 | */ |
||
57 | public function setContext(RequestContext $context) |
||
61 | |||
62 | /** |
||
63 | * @return mixed |
||
64 | */ |
||
65 | public function getContext() |
||
69 | |||
70 | /** |
||
71 | * @return \Aura\Router\RouteCollection |
||
72 | */ |
||
73 | public function getRouteCollection() |
||
74 | { |
||
75 | // @todo - need to check the signature of these, with what's expected of Symfony's RouteCollection |
||
76 | return $this->router->getRoutes(); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @param string $name |
||
81 | * @param array $parameters |
||
82 | * @param bool|string $referenceType |
||
83 | * |
||
84 | * @return false|string |
||
85 | */ |
||
86 | public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) |
||
87 | { |
||
88 | $ret = $this->router->generate($name, $parameters); |
||
89 | if ($ret === false) { |
||
90 | throw new RouteNotFoundException('Unable to generate route for: ' . $name); |
||
91 | } |
||
92 | |||
93 | return $ret; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * @param string $pathinfo |
||
98 | * |
||
99 | * @throws \Exception |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | public function match($pathinfo) |
||
107 | |||
108 | /** |
||
109 | * @param Request $request |
||
110 | * |
||
111 | * @throws \Exception |
||
112 | * |
||
113 | * @return array |
||
114 | */ |
||
115 | public function matchRequest(Request $request) |
||
119 | |||
120 | /** |
||
121 | * @param $pathinfo |
||
122 | * @param Request $request |
||
123 | * |
||
124 | * @throws \Exception |
||
125 | * |
||
126 | * @return array |
||
127 | */ |
||
128 | protected function doMatch($pathinfo, Request $request = null) |
||
170 | } |
||
171 |