48ecdf81c001d3d340acfd1a8280f9af30467f40
[yaffs-website] / vendor / symfony / routing / Tests / Fixtures / dumper / url_matcher6.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, '/trailing/simple')) {
32             // simple_trailing_slash_no_methods
33             if ('/trailing/simple/no-methods/' === $pathinfo) {
34                 return array('_route' => 'simple_trailing_slash_no_methods');
35             }
36
37             // simple_trailing_slash_GET_method
38             if ('/trailing/simple/get-method/' === $pathinfo) {
39                 $ret = array('_route' => 'simple_trailing_slash_GET_method');
40                 if (!in_array($canonicalMethod, array('GET'))) {
41                     $allow = array_merge($allow, array('GET'));
42                     goto not_simple_trailing_slash_GET_method;
43                 }
44
45                 return $ret;
46             }
47             not_simple_trailing_slash_GET_method:
48
49             // simple_trailing_slash_HEAD_method
50             if ('/trailing/simple/head-method/' === $pathinfo) {
51                 $ret = array('_route' => 'simple_trailing_slash_HEAD_method');
52                 if (!in_array($requestMethod, array('HEAD'))) {
53                     $allow = array_merge($allow, array('HEAD'));
54                     goto not_simple_trailing_slash_HEAD_method;
55                 }
56
57                 return $ret;
58             }
59             not_simple_trailing_slash_HEAD_method:
60
61             // simple_trailing_slash_POST_method
62             if ('/trailing/simple/post-method/' === $pathinfo) {
63                 $ret = array('_route' => 'simple_trailing_slash_POST_method');
64                 if (!in_array($requestMethod, array('POST'))) {
65                     $allow = array_merge($allow, array('POST'));
66                     goto not_simple_trailing_slash_POST_method;
67                 }
68
69                 return $ret;
70             }
71             not_simple_trailing_slash_POST_method:
72
73         }
74
75         elseif (0 === strpos($pathinfo, '/trailing/regex')) {
76             // regex_trailing_slash_no_methods
77             if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
78                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
79             }
80
81             // regex_trailing_slash_GET_method
82             if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
83                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
84                 if (!in_array($canonicalMethod, array('GET'))) {
85                     $allow = array_merge($allow, array('GET'));
86                     goto not_regex_trailing_slash_GET_method;
87                 }
88
89                 return $ret;
90             }
91             not_regex_trailing_slash_GET_method:
92
93             // regex_trailing_slash_HEAD_method
94             if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
95                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
96                 if (!in_array($requestMethod, array('HEAD'))) {
97                     $allow = array_merge($allow, array('HEAD'));
98                     goto not_regex_trailing_slash_HEAD_method;
99                 }
100
101                 return $ret;
102             }
103             not_regex_trailing_slash_HEAD_method:
104
105             // regex_trailing_slash_POST_method
106             if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
107                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
108                 if (!in_array($requestMethod, array('POST'))) {
109                     $allow = array_merge($allow, array('POST'));
110                     goto not_regex_trailing_slash_POST_method;
111                 }
112
113                 return $ret;
114             }
115             not_regex_trailing_slash_POST_method:
116
117         }
118
119         elseif (0 === strpos($pathinfo, '/not-trailing/simple')) {
120             // simple_not_trailing_slash_no_methods
121             if ('/not-trailing/simple/no-methods' === $pathinfo) {
122                 return array('_route' => 'simple_not_trailing_slash_no_methods');
123             }
124
125             // simple_not_trailing_slash_GET_method
126             if ('/not-trailing/simple/get-method' === $pathinfo) {
127                 $ret = array('_route' => 'simple_not_trailing_slash_GET_method');
128                 if (!in_array($canonicalMethod, array('GET'))) {
129                     $allow = array_merge($allow, array('GET'));
130                     goto not_simple_not_trailing_slash_GET_method;
131                 }
132
133                 return $ret;
134             }
135             not_simple_not_trailing_slash_GET_method:
136
137             // simple_not_trailing_slash_HEAD_method
138             if ('/not-trailing/simple/head-method' === $pathinfo) {
139                 $ret = array('_route' => 'simple_not_trailing_slash_HEAD_method');
140                 if (!in_array($requestMethod, array('HEAD'))) {
141                     $allow = array_merge($allow, array('HEAD'));
142                     goto not_simple_not_trailing_slash_HEAD_method;
143                 }
144
145                 return $ret;
146             }
147             not_simple_not_trailing_slash_HEAD_method:
148
149             // simple_not_trailing_slash_POST_method
150             if ('/not-trailing/simple/post-method' === $pathinfo) {
151                 $ret = array('_route' => 'simple_not_trailing_slash_POST_method');
152                 if (!in_array($requestMethod, array('POST'))) {
153                     $allow = array_merge($allow, array('POST'));
154                     goto not_simple_not_trailing_slash_POST_method;
155                 }
156
157                 return $ret;
158             }
159             not_simple_not_trailing_slash_POST_method:
160
161         }
162
163         elseif (0 === strpos($pathinfo, '/not-trailing/regex')) {
164             // regex_not_trailing_slash_no_methods
165             if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
166                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ());
167             }
168
169             // regex_not_trailing_slash_GET_method
170             if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
171                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
172                 if (!in_array($canonicalMethod, array('GET'))) {
173                     $allow = array_merge($allow, array('GET'));
174                     goto not_regex_not_trailing_slash_GET_method;
175                 }
176
177                 return $ret;
178             }
179             not_regex_not_trailing_slash_GET_method:
180
181             // regex_not_trailing_slash_HEAD_method
182             if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
183                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
184                 if (!in_array($requestMethod, array('HEAD'))) {
185                     $allow = array_merge($allow, array('HEAD'));
186                     goto not_regex_not_trailing_slash_HEAD_method;
187                 }
188
189                 return $ret;
190             }
191             not_regex_not_trailing_slash_HEAD_method:
192
193             // regex_not_trailing_slash_POST_method
194             if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
195                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
196                 if (!in_array($requestMethod, array('POST'))) {
197                     $allow = array_merge($allow, array('POST'));
198                     goto not_regex_not_trailing_slash_POST_method;
199                 }
200
201                 return $ret;
202             }
203             not_regex_not_trailing_slash_POST_method:
204
205         }
206
207         if ('/' === $pathinfo && !$allow) {
208             throw new Symfony\Component\Routing\Exception\NoConfigurationException();
209         }
210
211         throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
212     }
213 }