67c4667467e6f56bd4a6f0206e92adc9fe1860c0
[yaffs-website] / vendor / symfony / routing / Tests / Fixtures / dumper / url_matcher3.php
1 <?php
2
3 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
4 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
5 use Symfony\Component\Routing\RequestContext;
6
7 /**
8  * This class has been auto-generated
9  * by the Symfony Routing Component.
10  */
11 class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
12 {
13     public function __construct(RequestContext $context)
14     {
15         $this->context = $context;
16     }
17
18     public function match($rawPathinfo)
19     {
20         $allow = array();
21         $pathinfo = rawurldecode($rawPathinfo);
22         $trimmedPathinfo = rtrim($pathinfo, '/');
23         $context = $this->context;
24         $request = $this->request ?: $this->createRequest($pathinfo);
25         $requestMethod = $canonicalMethod = $context->getMethod();
26
27         if ('HEAD' === $requestMethod) {
28             $canonicalMethod = 'GET';
29         }
30
31         if (0 === strpos($pathinfo, '/rootprefix')) {
32             // static
33             if ('/rootprefix/test' === $pathinfo) {
34                 return array('_route' => 'static');
35             }
36
37             // dynamic
38             if (preg_match('#^/rootprefix/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
39                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ());
40             }
41
42         }
43
44         // with-condition
45         if ('/with-condition' === $pathinfo && ($context->getMethod() == "GET")) {
46             return array('_route' => 'with-condition');
47         }
48
49         if ('/' === $pathinfo && !$allow) {
50             throw new Symfony\Component\Routing\Exception\NoConfigurationException();
51         }
52
53         throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
54     }
55 }