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