url_matcher1.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. return false;
  34. }
  35. }