3 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
4 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
5 use Symfony\Component\Routing\RequestContext;
10 * This class has been auto-generated
11 * by the Symfony Routing Component.
13 class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher
18 public function __construct(RequestContext $context)
20 $this->context = $context;
23 public function match($pathinfo)
26 $pathinfo = rawurldecode($pathinfo);
27 $context = $this->context;
28 $request = $this->request;
31 if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?P<bar>baz|symfony)$#s', $pathinfo, $matches)) {
32 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
35 if (0 === strpos($pathinfo, '/bar')) {
37 if (preg_match('#^/bar/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
38 if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
39 $allow = array_merge($allow, array('GET', 'HEAD'));
43 return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
48 if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
49 if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
50 $allow = array_merge($allow, array('GET', 'HEAD'));
54 return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
60 if (0 === strpos($pathinfo, '/test')) {
61 if (0 === strpos($pathinfo, '/test/baz')) {
63 if ($pathinfo === '/test/baz') {
64 return array('_route' => 'baz');
68 if ($pathinfo === '/test/baz.html') {
69 return array('_route' => 'baz2');
73 if (rtrim($pathinfo, '/') === '/test/baz3') {
74 if (substr($pathinfo, -1) !== '/') {
75 return $this->redirect($pathinfo.'/', 'baz3');
78 return array('_route' => 'baz3');
84 if (preg_match('#^/test/(?P<foo>[^/]++)/?$#s', $pathinfo, $matches)) {
85 if (substr($pathinfo, -1) !== '/') {
86 return $this->redirect($pathinfo.'/', 'baz4');
89 return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
93 if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
94 if ($this->context->getMethod() != 'POST') {
99 return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
104 if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
105 if ($this->context->getMethod() != 'PUT') {
110 return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
117 if ($pathinfo === '/foofoo') {
118 return array ( 'def' => 'test', '_route' => 'foofoo',);
122 if (preg_match('#^/(?P<quoter>[\']+)$#s', $pathinfo, $matches)) {
123 return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
127 if ($pathinfo === '/spa ce') {
128 return array('_route' => 'space');
131 if (0 === strpos($pathinfo, '/a')) {
132 if (0 === strpos($pathinfo, '/a/b\'b')) {
134 if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
135 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
139 if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
140 return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
146 if (preg_match('#^/a/(?P<var>.*)$#s', $pathinfo, $matches)) {
147 return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
150 if (0 === strpos($pathinfo, '/a/b\'b')) {
152 if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#s', $pathinfo, $matches)) {
153 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
157 if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#s', $pathinfo, $matches)) {
158 return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
165 if (0 === strpos($pathinfo, '/multi')) {
167 if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#s', $pathinfo, $matches)) {
168 return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
172 if ($pathinfo === '/multi/new') {
173 return array('_route' => 'overridden2');
177 if (rtrim($pathinfo, '/') === '/multi/hey') {
178 if (substr($pathinfo, -1) !== '/') {
179 return $this->redirect($pathinfo.'/', 'hey');
182 return array('_route' => 'hey');
188 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
189 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
193 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
194 return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
197 if (0 === strpos($pathinfo, '/aba')) {
199 if ($pathinfo === '/ababa') {
200 return array('_route' => 'ababa');
204 if (preg_match('#^/aba/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
205 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
210 $host = $this->context->getHost();
212 if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
214 if ($pathinfo === '/route1') {
215 return array('_route' => 'route1');
219 if ($pathinfo === '/c2/route2') {
220 return array('_route' => 'route2');
225 if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) {
227 if ($pathinfo === '/c2/route3') {
228 return array('_route' => 'route3');
233 if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
235 if ($pathinfo === '/route4') {
236 return array('_route' => 'route4');
241 if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
243 if ($pathinfo === '/route5') {
244 return array('_route' => 'route5');
250 if ($pathinfo === '/route6') {
251 return array('_route' => 'route6');
254 if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) {
255 if (0 === strpos($pathinfo, '/route1')) {
257 if ($pathinfo === '/route11') {
258 return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ());
262 if ($pathinfo === '/route12') {
263 return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',));
267 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
268 return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
272 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
273 return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
280 if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
282 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
283 return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
288 if (0 === strpos($pathinfo, '/route1')) {
290 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
291 return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
295 if ($pathinfo === '/route17') {
296 return array('_route' => 'route17');
301 if (0 === strpos($pathinfo, '/a')) {
303 if ($pathinfo === '/a/a...') {
304 return array('_route' => 'a');
307 if (0 === strpos($pathinfo, '/a/b')) {
309 if (preg_match('#^/a/b/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
310 return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
314 if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
315 return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
323 if ($pathinfo === '/secure') {
324 $requiredSchemes = array ( 'https' => 0,);
325 if (!isset($requiredSchemes[$this->context->getScheme()])) {
326 return $this->redirect($pathinfo, 'secure', key($requiredSchemes));
329 return array('_route' => 'secure');
333 if ($pathinfo === '/nonsecure') {
334 $requiredSchemes = array ( 'http' => 0,);
335 if (!isset($requiredSchemes[$this->context->getScheme()])) {
336 return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes));
339 return array('_route' => 'nonsecure');
342 throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();