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