Minor dependency updates
[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  * ProjectUrlMatcher.
9  *
10  * This class has been auto-generated
11  * by the Symfony Routing Component.
12  */
13 class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
14 {
15     /**
16      * Constructor.
17      */
18     public function __construct(RequestContext $context)
19     {
20         $this->context = $context;
21     }
22
23     public function match($pathinfo)
24     {
25         $allow = array();
26         $pathinfo = rawurldecode($pathinfo);
27         $context = $this->context;
28         $request = $this->request;
29
30         if (0 === strpos($pathinfo, '/rootprefix')) {
31             // static
32             if ($pathinfo === '/rootprefix/test') {
33                 return array('_route' => 'static');
34             }
35
36             // dynamic
37             if (preg_match('#^/rootprefix/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
38                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ());
39             }
40
41         }
42
43         // with-condition
44         if ($pathinfo === '/with-condition' && ($context->getMethod() == "GET")) {
45             return array('_route' => 'with-condition');
46         }
47
48         throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
49     }
50 }