url_matcher6.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <?php
  2. use Symfony\Component\Routing\Exception\MethodNotAllowedException;
  3. use Symfony\Component\Routing\Exception\ResourceNotFoundException;
  4. use Symfony\Component\Routing\RequestContext;
  5. /**
  6. * ProjectUrlMatcher.
  7. *
  8. * This class has been auto-generated
  9. * by the Symfony Routing Component.
  10. */
  11. class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
  12. {
  13. /**
  14. * Constructor.
  15. */
  16. public function __construct(RequestContext $context)
  17. {
  18. $this->context = $context;
  19. }
  20. public function match($pathinfo)
  21. {
  22. $allow = array();
  23. $pathinfo = rawurldecode($pathinfo);
  24. $trimmedPathinfo = rtrim($pathinfo, '/');
  25. $context = $this->context;
  26. $request = $this->request;
  27. $requestMethod = $canonicalMethod = $context->getMethod();
  28. $scheme = $context->getScheme();
  29. if ('HEAD' === $requestMethod) {
  30. $canonicalMethod = 'GET';
  31. }
  32. if (0 === strpos($pathinfo, '/trailing/simple')) {
  33. // simple_trailing_slash_no_methods
  34. if ('/trailing/simple/no-methods/' === $pathinfo) {
  35. return array('_route' => 'simple_trailing_slash_no_methods');
  36. }
  37. // simple_trailing_slash_GET_method
  38. if ('/trailing/simple/get-method/' === $pathinfo) {
  39. if ('GET' !== $canonicalMethod) {
  40. $allow[] = 'GET';
  41. goto not_simple_trailing_slash_GET_method;
  42. }
  43. return array('_route' => 'simple_trailing_slash_GET_method');
  44. }
  45. not_simple_trailing_slash_GET_method:
  46. // simple_trailing_slash_HEAD_method
  47. if ('/trailing/simple/head-method/' === $pathinfo) {
  48. if ('HEAD' !== $requestMethod) {
  49. $allow[] = 'HEAD';
  50. goto not_simple_trailing_slash_HEAD_method;
  51. }
  52. return array('_route' => 'simple_trailing_slash_HEAD_method');
  53. }
  54. not_simple_trailing_slash_HEAD_method:
  55. // simple_trailing_slash_POST_method
  56. if ('/trailing/simple/post-method/' === $pathinfo) {
  57. if ('POST' !== $canonicalMethod) {
  58. $allow[] = 'POST';
  59. goto not_simple_trailing_slash_POST_method;
  60. }
  61. return array('_route' => 'simple_trailing_slash_POST_method');
  62. }
  63. not_simple_trailing_slash_POST_method:
  64. }
  65. elseif (0 === strpos($pathinfo, '/trailing/regex')) {
  66. // regex_trailing_slash_no_methods
  67. if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
  68. return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
  69. }
  70. // regex_trailing_slash_GET_method
  71. if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
  72. if ('GET' !== $canonicalMethod) {
  73. $allow[] = 'GET';
  74. goto not_regex_trailing_slash_GET_method;
  75. }
  76. return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
  77. }
  78. not_regex_trailing_slash_GET_method:
  79. // regex_trailing_slash_HEAD_method
  80. if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
  81. if ('HEAD' !== $requestMethod) {
  82. $allow[] = 'HEAD';
  83. goto not_regex_trailing_slash_HEAD_method;
  84. }
  85. return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
  86. }
  87. not_regex_trailing_slash_HEAD_method:
  88. // regex_trailing_slash_POST_method
  89. if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
  90. if ('POST' !== $canonicalMethod) {
  91. $allow[] = 'POST';
  92. goto not_regex_trailing_slash_POST_method;
  93. }
  94. return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
  95. }
  96. not_regex_trailing_slash_POST_method:
  97. }
  98. elseif (0 === strpos($pathinfo, '/not-trailing/simple')) {
  99. // simple_not_trailing_slash_no_methods
  100. if ('/not-trailing/simple/no-methods' === $pathinfo) {
  101. return array('_route' => 'simple_not_trailing_slash_no_methods');
  102. }
  103. // simple_not_trailing_slash_GET_method
  104. if ('/not-trailing/simple/get-method' === $pathinfo) {
  105. if ('GET' !== $canonicalMethod) {
  106. $allow[] = 'GET';
  107. goto not_simple_not_trailing_slash_GET_method;
  108. }
  109. return array('_route' => 'simple_not_trailing_slash_GET_method');
  110. }
  111. not_simple_not_trailing_slash_GET_method:
  112. // simple_not_trailing_slash_HEAD_method
  113. if ('/not-trailing/simple/head-method' === $pathinfo) {
  114. if ('HEAD' !== $requestMethod) {
  115. $allow[] = 'HEAD';
  116. goto not_simple_not_trailing_slash_HEAD_method;
  117. }
  118. return array('_route' => 'simple_not_trailing_slash_HEAD_method');
  119. }
  120. not_simple_not_trailing_slash_HEAD_method:
  121. // simple_not_trailing_slash_POST_method
  122. if ('/not-trailing/simple/post-method' === $pathinfo) {
  123. if ('POST' !== $canonicalMethod) {
  124. $allow[] = 'POST';
  125. goto not_simple_not_trailing_slash_POST_method;
  126. }
  127. return array('_route' => 'simple_not_trailing_slash_POST_method');
  128. }
  129. not_simple_not_trailing_slash_POST_method:
  130. }
  131. elseif (0 === strpos($pathinfo, '/not-trailing/regex')) {
  132. // regex_not_trailing_slash_no_methods
  133. if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
  134. return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ());
  135. }
  136. // regex_not_trailing_slash_GET_method
  137. if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
  138. if ('GET' !== $canonicalMethod) {
  139. $allow[] = 'GET';
  140. goto not_regex_not_trailing_slash_GET_method;
  141. }
  142. return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
  143. }
  144. not_regex_not_trailing_slash_GET_method:
  145. // regex_not_trailing_slash_HEAD_method
  146. if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
  147. if ('HEAD' !== $requestMethod) {
  148. $allow[] = 'HEAD';
  149. goto not_regex_not_trailing_slash_HEAD_method;
  150. }
  151. return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
  152. }
  153. not_regex_not_trailing_slash_HEAD_method:
  154. // regex_not_trailing_slash_POST_method
  155. if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
  156. if ('POST' !== $canonicalMethod) {
  157. $allow[] = 'POST';
  158. goto not_regex_not_trailing_slash_POST_method;
  159. }
  160. return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
  161. }
  162. not_regex_not_trailing_slash_POST_method:
  163. }
  164. throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
  165. }
  166. }