3 use Symfony\Component\Routing\Exception\MethodNotAllowedException
;
4 use Symfony\Component\Routing\Exception\ResourceNotFoundException
;
5 use Symfony\Component\Routing\RequestContext
;
10 * This class has been auto-generated
11 * by the Symfony Routing Component.
13 class ProjectUrlMatcher
extends Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher
18 public function __construct(RequestContext
$context)
20 $this->context
= $context;
23 public function match($pathinfo)
26 $pathinfo = rawurldecode($pathinfo);
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',));
33 if (0 === strpos($pathinfo, '/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'));
41 return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
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'));
52 return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
58 if (0 === strpos($pathinfo, '/test')) {
59 if (0 === strpos($pathinfo, '/test/baz')) {
61 if ($pathinfo === '/test/baz') {
62 return array('_route' => 'baz');
66 if ($pathinfo === '/test/baz.html') {
67 return array('_route' => 'baz2');
71 if (rtrim($pathinfo, '/') === '/test/baz3') {
72 if (substr($pathinfo, -1) !== '/') {
73 return $this->redirect($pathinfo.'/', 'baz3');
76 return array('_route' => 'baz3');
82 if (preg_match('#^/test/(?P<foo>[^/]++)/?$#s', $pathinfo, $matches)) {
83 if (substr($pathinfo, -1) !== '/') {
84 return $this->redirect($pathinfo.'/', 'baz4');
87 return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
91 if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
92 if ($this->context
->getMethod() != 'POST') {
97 return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
102 if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
103 if ($this->context
->getMethod() != 'PUT') {
108 return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
115 if ($pathinfo === '/foofoo') {
116 return array ( 'def' => 'test', '_route' => 'foofoo',);
120 if (preg_match('#^/(?P<quoter>[\']+)$#s', $pathinfo, $matches)) {
121 return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
125 if ($pathinfo === '/spa ce') {
126 return array('_route' => 'space');
129 if (0 === strpos($pathinfo, '/a')) {
130 if (0 === strpos($pathinfo, '/a/b\'b')) {
132 if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
133 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
137 if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
138 return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
144 if (preg_match('#^/a/(?P<var>.*)$#s', $pathinfo, $matches)) {
145 return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
148 if (0 === strpos($pathinfo, '/a/b\'b')) {
150 if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#s', $pathinfo, $matches)) {
151 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
155 if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#s', $pathinfo, $matches)) {
156 return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
163 if (0 === strpos($pathinfo, '/multi')) {
165 if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#s', $pathinfo, $matches)) {
166 return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
170 if ($pathinfo === '/multi/new') {
171 return array('_route' => 'overridden2');
175 if (rtrim($pathinfo, '/') === '/multi/hey') {
176 if (substr($pathinfo, -1) !== '/') {
177 return $this->redirect($pathinfo.'/', 'hey');
180 return array('_route' => 'hey');
186 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
187 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
191 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
192 return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
195 if (0 === strpos($pathinfo, '/aba')) {
197 if ($pathinfo === '/ababa') {
198 return array('_route' => 'ababa');
202 if (preg_match('#^/aba/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
203 return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
208 $host = $this->context
->getHost();
210 if (preg_match('#^a\\.example\\.com$#s', $host, $hostMatches)) {
212 if ($pathinfo === '/route1') {
213 return array('_route' => 'route1');
217 if ($pathinfo === '/c2/route2') {
218 return array('_route' => 'route2');
223 if (preg_match('#^b\\.example\\.com$#s', $host, $hostMatches)) {
225 if ($pathinfo === '/c2/route3') {
226 return array('_route' => 'route3');
231 if (preg_match('#^a\\.example\\.com$#s', $host, $hostMatches)) {
233 if ($pathinfo === '/route4') {
234 return array('_route' => 'route4');
239 if (preg_match('#^c\\.example\\.com$#s', $host, $hostMatches)) {
241 if ($pathinfo === '/route5') {
242 return array('_route' => 'route5');
248 if ($pathinfo === '/route6') {
249 return array('_route' => 'route6');
252 if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#s', $host, $hostMatches)) {
253 if (0 === strpos($pathinfo, '/route1')) {
255 if ($pathinfo === '/route11') {
256 return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ());
260 if ($pathinfo === '/route12') {
261 return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',));
265 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
266 return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
270 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
271 return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
278 if (preg_match('#^c\\.example\\.com$#s', $host, $hostMatches)) {
280 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
281 return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
286 if (0 === strpos($pathinfo, '/route1')) {
288 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
289 return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
293 if ($pathinfo === '/route17') {
294 return array('_route' => 'route17');
299 if (0 === strpos($pathinfo, '/a')) {
301 if ($pathinfo === '/a/a...') {
302 return array('_route' => 'a');
305 if (0 === strpos($pathinfo, '/a/b')) {
307 if (preg_match('#^/a/b/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
308 return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
312 if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
313 return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
321 if ($pathinfo === '/secure') {
322 if ($this->context
->getScheme() !== 'https') {
323 return $this->redirect($pathinfo, 'secure', 'https');
326 return array('_route' => 'secure');
330 if ($pathinfo === '/nonsecure') {
331 if ($this->context
->getScheme() !== 'http') {
332 return $this->redirect($pathinfo, 'nonsecure', 'http');
335 return array('_route' => 'nonsecure');
338 throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();