23a93c193423d11c1db4d509857ee7c4d46fae9e
[yaffs-website] / vendor / symfony / routing / Tests / Fixtures / dumper / url_matcher1.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, '/foo')) {
32             // foo
33             if (preg_match('#^/foo/(?P<bar>baz|symfony)$#sD', $pathinfo, $matches)) {
34                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array (  'def' => 'test',));
35             }
36
37             // foofoo
38             if ('/foofoo' === $pathinfo) {
39                 return array (  'def' => 'test',  '_route' => 'foofoo',);
40             }
41
42         }
43
44         elseif (0 === strpos($pathinfo, '/bar')) {
45             // bar
46             if (preg_match('#^/bar/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
47                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
48                 if (!in_array($canonicalMethod, array('GET', 'HEAD'))) {
49                     $allow = array_merge($allow, array('GET', 'HEAD'));
50                     goto not_bar;
51                 }
52
53                 return $ret;
54             }
55             not_bar:
56
57             // barhead
58             if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
59                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
60                 if (!in_array($canonicalMethod, array('GET'))) {
61                     $allow = array_merge($allow, array('GET'));
62                     goto not_barhead;
63                 }
64
65                 return $ret;
66             }
67             not_barhead:
68
69         }
70
71         elseif (0 === strpos($pathinfo, '/test')) {
72             if (0 === strpos($pathinfo, '/test/baz')) {
73                 // baz
74                 if ('/test/baz' === $pathinfo) {
75                     return array('_route' => 'baz');
76                 }
77
78                 // baz2
79                 if ('/test/baz.html' === $pathinfo) {
80                     return array('_route' => 'baz2');
81                 }
82
83                 // baz3
84                 if ('/test/baz3/' === $pathinfo) {
85                     return array('_route' => 'baz3');
86                 }
87
88             }
89
90             // baz4
91             if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
92                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
93             }
94
95             // baz5
96             if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
97                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
98                 if (!in_array($requestMethod, array('POST'))) {
99                     $allow = array_merge($allow, array('POST'));
100                     goto not_baz5;
101                 }
102
103                 return $ret;
104             }
105             not_baz5:
106
107             // baz.baz6
108             if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
109                 $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
110                 if (!in_array($requestMethod, array('PUT'))) {
111                     $allow = array_merge($allow, array('PUT'));
112                     goto not_bazbaz6;
113                 }
114
115                 return $ret;
116             }
117             not_bazbaz6:
118
119         }
120
121         // quoter
122         if (preg_match('#^/(?P<quoter>[\']+)$#sD', $pathinfo, $matches)) {
123             return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
124         }
125
126         // space
127         if ('/spa ce' === $pathinfo) {
128             return array('_route' => 'space');
129         }
130
131         if (0 === strpos($pathinfo, '/a')) {
132             if (0 === strpos($pathinfo, '/a/b\'b')) {
133                 // foo1
134                 if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
135                     return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
136                 }
137
138                 // bar1
139                 if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
140                     return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
141                 }
142
143             }
144
145             // overridden
146             if (preg_match('#^/a/(?P<var>.*)$#sD', $pathinfo, $matches)) {
147                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
148             }
149
150             if (0 === strpos($pathinfo, '/a/b\'b')) {
151                 // foo2
152                 if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#sD', $pathinfo, $matches)) {
153                     return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
154                 }
155
156                 // bar2
157                 if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#sD', $pathinfo, $matches)) {
158                     return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
159                 }
160
161             }
162
163         }
164
165         elseif (0 === strpos($pathinfo, '/multi')) {
166             // helloWorld
167             if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#sD', $pathinfo, $matches)) {
168                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array (  'who' => 'World!',));
169             }
170
171             // hey
172             if ('/multi/hey/' === $pathinfo) {
173                 return array('_route' => 'hey');
174             }
175
176             // overridden2
177             if ('/multi/new' === $pathinfo) {
178                 return array('_route' => 'overridden2');
179             }
180
181         }
182
183         // foo3
184         if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
185             return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
186         }
187
188         // bar3
189         if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
190             return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
191         }
192
193         if (0 === strpos($pathinfo, '/aba')) {
194             // ababa
195             if ('/ababa' === $pathinfo) {
196                 return array('_route' => 'ababa');
197             }
198
199             // foo4
200             if (preg_match('#^/aba/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
201                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
202             }
203
204         }
205
206         $host = $context->getHost();
207
208         if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
209             // route1
210             if ('/route1' === $pathinfo) {
211                 return array('_route' => 'route1');
212             }
213
214             // route2
215             if ('/c2/route2' === $pathinfo) {
216                 return array('_route' => 'route2');
217             }
218
219         }
220
221         if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) {
222             // route3
223             if ('/c2/route3' === $pathinfo) {
224                 return array('_route' => 'route3');
225             }
226
227         }
228
229         if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
230             // route4
231             if ('/route4' === $pathinfo) {
232                 return array('_route' => 'route4');
233             }
234
235         }
236
237         if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
238             // route5
239             if ('/route5' === $pathinfo) {
240                 return array('_route' => 'route5');
241             }
242
243         }
244
245         // route6
246         if ('/route6' === $pathinfo) {
247             return array('_route' => 'route6');
248         }
249
250         if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) {
251             if (0 === strpos($pathinfo, '/route1')) {
252                 // route11
253                 if ('/route11' === $pathinfo) {
254                     return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ());
255                 }
256
257                 // route12
258                 if ('/route12' === $pathinfo) {
259                     return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array (  'var1' => 'val',));
260                 }
261
262                 // route13
263                 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
264                     return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
265                 }
266
267                 // route14
268                 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
269                     return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array (  'var1' => 'val',));
270                 }
271
272             }
273
274         }
275
276         if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
277             // route15
278             if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
279                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
280             }
281
282         }
283
284         // route16
285         if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
286             return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array (  'var1' => 'val',));
287         }
288
289         // route17
290         if ('/route17' === $pathinfo) {
291             return array('_route' => 'route17');
292         }
293
294         // a
295         if ('/a/a...' === $pathinfo) {
296             return array('_route' => 'a');
297         }
298
299         if (0 === strpos($pathinfo, '/a/b')) {
300             // b
301             if (preg_match('#^/a/b/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
302                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
303             }
304
305             // c
306             if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
307                 return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
308             }
309
310         }
311
312         if ('/' === $pathinfo && !$allow) {
313             throw new Symfony\Component\Routing\Exception\NoConfigurationException();
314         }
315
316         throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
317     }
318 }