Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 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\Tests\Fixtures\RedirectableUrlMatcher
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 (rtrim($pathinfo, '/') === '/test/baz3') {
74
                    if (substr($pathinfo, -1) !== '/') {
75
                        return $this->redirect($pathinfo.'/', 'baz3');
76
                    }
77
 
78
                    return array('_route' => 'baz3');
79
                }
80
 
81
            }
82
 
83
            // baz4
84
            if (preg_match('#^/test/(?P<foo>[^/]++)/?$#s', $pathinfo, $matches)) {
85
                if (substr($pathinfo, -1) !== '/') {
86
                    return $this->redirect($pathinfo.'/', 'baz4');
87
                }
88
 
89
                return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
90
            }
91
 
92
            // baz5
93
            if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
94
                if ($this->context->getMethod() != 'POST') {
95
                    $allow[] = 'POST';
96
                    goto not_baz5;
97
                }
98
 
99
                return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
100
            }
101
            not_baz5:
102
 
103
            // baz.baz6
104
            if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
105
                if ($this->context->getMethod() != 'PUT') {
106
                    $allow[] = 'PUT';
107
                    goto not_bazbaz6;
108
                }
109
 
110
                return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
111
            }
112
            not_bazbaz6:
113
 
114
        }
115
 
116
        // foofoo
117
        if ($pathinfo === '/foofoo') {
118
            return array (  'def' => 'test',  '_route' => 'foofoo',);
119
        }
120
 
121
        // quoter
122
        if (preg_match('#^/(?P<quoter>[\']+)$#s', $pathinfo, $matches)) {
123
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
124
        }
125
 
126
        // space
127
        if ($pathinfo === '/spa ce') {
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>[^/]++)$#s', $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>[^/]++)$#s', $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>.*)$#s', $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>[^/]++)$#s', $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>[^/]++)$#s', $pathinfo, $matches)) {
158
                    return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
159
                }
160
 
161
            }
162
 
163
        }
164
 
165
        if (0 === strpos($pathinfo, '/multi')) {
166
            // helloWorld
167
            if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#s', $pathinfo, $matches)) {
168
                return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array (  'who' => 'World!',));
169
            }
170
 
171
            // overridden2
172
            if ($pathinfo === '/multi/new') {
173
                return array('_route' => 'overridden2');
174
            }
175
 
176
            // hey
177
            if (rtrim($pathinfo, '/') === '/multi/hey') {
178
                if (substr($pathinfo, -1) !== '/') {
179
                    return $this->redirect($pathinfo.'/', 'hey');
180
                }
181
 
182
                return array('_route' => 'hey');
183
            }
184
 
185
        }
186
 
187
        // foo3
188
        if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
189
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
190
        }
191
 
192
        // bar3
193
        if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
194
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
195
        }
196
 
197
        if (0 === strpos($pathinfo, '/aba')) {
198
            // ababa
199
            if ($pathinfo === '/ababa') {
200
                return array('_route' => 'ababa');
201
            }
202
 
203
            // foo4
204
            if (preg_match('#^/aba/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
205
                return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
206
            }
207
 
208
        }
209
 
210
        $host = $this->context->getHost();
211
 
212
        if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
213
            // route1
214
            if ($pathinfo === '/route1') {
215
                return array('_route' => 'route1');
216
            }
217
 
218
            // route2
219
            if ($pathinfo === '/c2/route2') {
220
                return array('_route' => 'route2');
221
            }
222
 
223
        }
224
 
225
        if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) {
226
            // route3
227
            if ($pathinfo === '/c2/route3') {
228
                return array('_route' => 'route3');
229
            }
230
 
231
        }
232
 
233
        if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
234
            // route4
235
            if ($pathinfo === '/route4') {
236
                return array('_route' => 'route4');
237
            }
238
 
239
        }
240
 
241
        if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
242
            // route5
243
            if ($pathinfo === '/route5') {
244
                return array('_route' => 'route5');
245
            }
246
 
247
        }
248
 
249
        // route6
250
        if ($pathinfo === '/route6') {
251
            return array('_route' => 'route6');
252
        }
253
 
254
        if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) {
255
            if (0 === strpos($pathinfo, '/route1')) {
256
                // route11
257
                if ($pathinfo === '/route11') {
258
                    return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ());
259
                }
260
 
261
                // route12
262
                if ($pathinfo === '/route12') {
263
                    return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array (  'var1' => 'val',));
264
                }
265
 
266
                // route13
267
                if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
268
                    return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
269
                }
270
 
271
                // route14
272
                if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
273
                    return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array (  'var1' => 'val',));
274
                }
275
 
276
            }
277
 
278
        }
279
 
280
        if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
281
            // route15
282
            if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
283
                return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
284
            }
285
 
286
        }
287
 
288
        if (0 === strpos($pathinfo, '/route1')) {
289
            // route16
290
            if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
291
                return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array (  'var1' => 'val',));
292
            }
293
 
294
            // route17
295
            if ($pathinfo === '/route17') {
296
                return array('_route' => 'route17');
297
            }
298
 
299
        }
300
 
301
        if (0 === strpos($pathinfo, '/a')) {
302
            // a
303
            if ($pathinfo === '/a/a...') {
304
                return array('_route' => 'a');
305
            }
306
 
307
            if (0 === strpos($pathinfo, '/a/b')) {
308
                // b
309
                if (preg_match('#^/a/b/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
310
                    return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
311
                }
312
 
313
                // c
314
                if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
315
                    return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
316
                }
317
 
318
            }
319
 
320
        }
321
 
322
        // secure
323
        if ($pathinfo === '/secure') {
324
            $requiredSchemes = array (  'https' => 0,);
325
            if (!isset($requiredSchemes[$this->context->getScheme()])) {
326
                return $this->redirect($pathinfo, 'secure', key($requiredSchemes));
327
            }
328
 
329
            return array('_route' => 'secure');
330
        }
331
 
332
        // nonsecure
333
        if ($pathinfo === '/nonsecure') {
334
            $requiredSchemes = array (  'http' => 0,);
335
            if (!isset($requiredSchemes[$this->context->getScheme()])) {
336
                return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes));
337
            }
338
 
339
            return array('_route' => 'nonsecure');
340
        }
341
 
342
        throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
343
    }
344
}