url_matcher1.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  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. return false;
  28. }
  29. }