url_matcher1.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * ProjectUrlMatcher
  4. *
  5. * This class has been auto-generated
  6. * by the Symfony Routing Component.
  7. */
  8. class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
  9. {
  10. /**
  11. * Constructor.
  12. */
  13. public function __construct(array $context = array(), array $defaults = array())
  14. {
  15. $this->context = $context;
  16. $this->defaults = $defaults;
  17. }
  18. public function match($url)
  19. {
  20. $url = $this->normalizeUrl($url);
  21. if (0 === strpos($url, '/foo') && preg_match('#^/foo/(?P<bar>baz|symfony)$#x', $url, $matches)) {
  22. return array_merge($this->mergeDefaults($matches, array ( 'def' => 'test',)), array('_route' => 'foo'));
  23. }
  24. if (isset($this->context['method']) && preg_match('#^(GET|head)$#xi', $this->context['method']) && 0 === strpos($url, '/bar') && preg_match('#^/bar/(?P<foo>[^/\.]+?)$#x', $url, $matches)) {
  25. return array_merge($this->mergeDefaults($matches, array ()), array('_route' => 'bar'));
  26. }
  27. if ($url === '/test/baz') {
  28. return array_merge($this->mergeDefaults(array(), array ()), array('_route' => 'baz'));
  29. }
  30. if ($url === '/test/baz.html') {
  31. return array_merge($this->mergeDefaults(array(), array ()), array('_route' => 'baz2'));
  32. }
  33. if (rtrim($url, '/') === '/test/baz3') {
  34. if (substr($url, -1) !== '/') {
  35. return array('_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction', 'url' => $this->context['base_url'].$url.'/', 'permanent' => true, '_route' => 'baz3');
  36. }
  37. return array_merge($this->mergeDefaults(array(), array ()), array('_route' => 'baz3'));
  38. }
  39. if (0 === strpos($url, '/test') && preg_match('#^/test/(?P<foo>[^/\.]+?)/?$#x', $url, $matches)) {
  40. if (substr($url, -1) !== '/') {
  41. return array('_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction', 'url' => $this->context['base_url'].$url.'/', 'permanent' => true, '_route' => 'baz4');
  42. }
  43. return array_merge($this->mergeDefaults($matches, array ()), array('_route' => 'baz4'));
  44. }
  45. return false;
  46. }
  47. }