菜谱项目

url_matcher1.php 11KB

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