url_matcher1.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <?php
  2. use Symfony\Component\Routing\Exception\MethodNotAllowedException;
  3. use Symfony\Component\Routing\Exception\ResourceNotFoundException;
  4. use Symfony\Component\Routing\RequestContext;
  5. /**
  6. * This class has been auto-generated
  7. * by the Symfony Routing Component.
  8. */
  9. class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
  10. {
  11. public function __construct(RequestContext $context)
  12. {
  13. $this->context = $context;
  14. }
  15. public function match($rawPathinfo)
  16. {
  17. $allow = array();
  18. $pathinfo = rawurldecode($rawPathinfo);
  19. $context = $this->context;
  20. $request = $this->request ?: $this->createRequest($pathinfo);
  21. // foo
  22. if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?P<bar>baz|symfony)$#sD', $pathinfo, $matches)) {
  23. return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
  24. }
  25. if (0 === strpos($pathinfo, '/bar')) {
  26. // bar
  27. if (preg_match('#^/bar/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
  28. if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
  29. $allow = array_merge($allow, array('GET', 'HEAD'));
  30. goto not_bar;
  31. }
  32. return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
  33. }
  34. not_bar:
  35. // barhead
  36. if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
  37. if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
  38. $allow = array_merge($allow, array('GET', 'HEAD'));
  39. goto not_barhead;
  40. }
  41. return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
  42. }
  43. not_barhead:
  44. }
  45. if (0 === strpos($pathinfo, '/test')) {
  46. if (0 === strpos($pathinfo, '/test/baz')) {
  47. // baz
  48. if ('/test/baz' === $pathinfo) {
  49. return array('_route' => 'baz');
  50. }
  51. // baz2
  52. if ('/test/baz.html' === $pathinfo) {
  53. return array('_route' => 'baz2');
  54. }
  55. // baz3
  56. if ('/test/baz3/' === $pathinfo) {
  57. return array('_route' => 'baz3');
  58. }
  59. }
  60. // baz4
  61. if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
  62. return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
  63. }
  64. // baz5
  65. if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
  66. if ($this->context->getMethod() != 'POST') {
  67. $allow[] = 'POST';
  68. goto not_baz5;
  69. }
  70. return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
  71. }
  72. not_baz5:
  73. // baz.baz6
  74. if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
  75. if ($this->context->getMethod() != 'PUT') {
  76. $allow[] = 'PUT';
  77. goto not_bazbaz6;
  78. }
  79. return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
  80. }
  81. not_bazbaz6:
  82. }
  83. // foofoo
  84. if ('/foofoo' === $pathinfo) {
  85. return array ( 'def' => 'test', '_route' => 'foofoo',);
  86. }
  87. // quoter
  88. if (preg_match('#^/(?P<quoter>[\']+)$#sD', $pathinfo, $matches)) {
  89. return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
  90. }
  91. // space
  92. if ('/spa ce' === $pathinfo) {
  93. return array('_route' => 'space');
  94. }
  95. if (0 === strpos($pathinfo, '/a')) {
  96. if (0 === strpos($pathinfo, '/a/b\'b')) {
  97. // foo1
  98. if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
  99. return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
  100. }
  101. // bar1
  102. if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
  103. return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
  104. }
  105. }
  106. // overridden
  107. if (preg_match('#^/a/(?P<var>.*)$#sD', $pathinfo, $matches)) {
  108. return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
  109. }
  110. if (0 === strpos($pathinfo, '/a/b\'b')) {
  111. // foo2
  112. if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#sD', $pathinfo, $matches)) {
  113. return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
  114. }
  115. // bar2
  116. if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#sD', $pathinfo, $matches)) {
  117. return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
  118. }
  119. }
  120. }
  121. if (0 === strpos($pathinfo, '/multi')) {
  122. // helloWorld
  123. if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#sD', $pathinfo, $matches)) {
  124. return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
  125. }
  126. // overridden2
  127. if ('/multi/new' === $pathinfo) {
  128. return array('_route' => 'overridden2');
  129. }
  130. // hey
  131. if ('/multi/hey/' === $pathinfo) {
  132. return array('_route' => 'hey');
  133. }
  134. }
  135. // foo3
  136. if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
  137. return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
  138. }
  139. // bar3
  140. if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
  141. return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
  142. }
  143. if (0 === strpos($pathinfo, '/aba')) {
  144. // ababa
  145. if ('/ababa' === $pathinfo) {
  146. return array('_route' => 'ababa');
  147. }
  148. // foo4
  149. if (preg_match('#^/aba/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
  150. return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
  151. }
  152. }
  153. $host = $this->context->getHost();
  154. if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
  155. // route1
  156. if ('/route1' === $pathinfo) {
  157. return array('_route' => 'route1');
  158. }
  159. // route2
  160. if ('/c2/route2' === $pathinfo) {
  161. return array('_route' => 'route2');
  162. }
  163. }
  164. if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) {
  165. // route3
  166. if ('/c2/route3' === $pathinfo) {
  167. return array('_route' => 'route3');
  168. }
  169. }
  170. if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
  171. // route4
  172. if ('/route4' === $pathinfo) {
  173. return array('_route' => 'route4');
  174. }
  175. }
  176. if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
  177. // route5
  178. if ('/route5' === $pathinfo) {
  179. return array('_route' => 'route5');
  180. }
  181. }
  182. // route6
  183. if ('/route6' === $pathinfo) {
  184. return array('_route' => 'route6');
  185. }
  186. if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) {
  187. if (0 === strpos($pathinfo, '/route1')) {
  188. // route11
  189. if ('/route11' === $pathinfo) {
  190. return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ());
  191. }
  192. // route12
  193. if ('/route12' === $pathinfo) {
  194. return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',));
  195. }
  196. // route13
  197. if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
  198. return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
  199. }
  200. // route14
  201. if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
  202. return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
  203. }
  204. }
  205. }
  206. if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
  207. // route15
  208. if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
  209. return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
  210. }
  211. }
  212. if (0 === strpos($pathinfo, '/route1')) {
  213. // route16
  214. if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
  215. return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
  216. }
  217. // route17
  218. if ('/route17' === $pathinfo) {
  219. return array('_route' => 'route17');
  220. }
  221. }
  222. if (0 === strpos($pathinfo, '/a')) {
  223. // a
  224. if ('/a/a...' === $pathinfo) {
  225. return array('_route' => 'a');
  226. }
  227. if (0 === strpos($pathinfo, '/a/b')) {
  228. // b
  229. if (preg_match('#^/a/b/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
  230. return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
  231. }
  232. // c
  233. if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
  234. return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
  235. }
  236. }
  237. }
  238. throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
  239. }
  240. }