Skip to content

Instantly share code, notes, and snippets.

@timothyjeffcoat
Created June 8, 2016 21:39
Show Gist options
  • Save timothyjeffcoat/b979b6cca1669315ec27640cc3bb247d to your computer and use it in GitHub Desktop.
Save timothyjeffcoat/b979b6cca1669315ec27640cc3bb247d to your computer and use it in GitHub Desktop.
appDevUrlMatcher.php
<?php
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* appDevUrlMatcher.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class appDevUrlMatcher extends Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher
{
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function match($pathinfo)
{
$allow = array();
$pathinfo = rawurldecode($pathinfo);
$context = $this->context;
$request = $this->request;
if (0 === strpos($pathinfo, '/_')) {
// _wdt
if (0 === strpos($pathinfo, '/_wdt') && preg_match('#^/_wdt/(?P<token>[^/]++)$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => '_wdt')), array ( '_controller' => 'web_profiler.controller.profiler:toolbarAction',));
}
if (0 === strpos($pathinfo, '/_profiler')) {
// _profiler_home
if (rtrim($pathinfo, '/') === '/_profiler') {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', '_profiler_home');
}
return array ( '_controller' => 'web_profiler.controller.profiler:homeAction', '_route' => '_profiler_home',);
}
if (0 === strpos($pathinfo, '/_profiler/search')) {
// _profiler_search
if ($pathinfo === '/_profiler/search') {
return array ( '_controller' => 'web_profiler.controller.profiler:searchAction', '_route' => '_profiler_search',);
}
// _profiler_search_bar
if ($pathinfo === '/_profiler/search_bar') {
return array ( '_controller' => 'web_profiler.controller.profiler:searchBarAction', '_route' => '_profiler_search_bar',);
}
}
// _profiler_purge
if ($pathinfo === '/_profiler/purge') {
return array ( '_controller' => 'web_profiler.controller.profiler:purgeAction', '_route' => '_profiler_purge',);
}
// _profiler_info
if (0 === strpos($pathinfo, '/_profiler/info') && preg_match('#^/_profiler/info/(?P<about>[^/]++)$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_info')), array ( '_controller' => 'web_profiler.controller.profiler:infoAction',));
}
// _profiler_phpinfo
if ($pathinfo === '/_profiler/phpinfo') {
return array ( '_controller' => 'web_profiler.controller.profiler:phpinfoAction', '_route' => '_profiler_phpinfo',);
}
// _profiler_search_results
if (preg_match('#^/_profiler/(?P<token>[^/]++)/search/results$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_search_results')), array ( '_controller' => 'web_profiler.controller.profiler:searchResultsAction',));
}
// _profiler
if (preg_match('#^/_profiler/(?P<token>[^/]++)$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler')), array ( '_controller' => 'web_profiler.controller.profiler:panelAction',));
}
// _profiler_router
if (preg_match('#^/_profiler/(?P<token>[^/]++)/router$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_router')), array ( '_controller' => 'web_profiler.controller.router:panelAction',));
}
// _profiler_exception
if (preg_match('#^/_profiler/(?P<token>[^/]++)/exception$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_exception')), array ( '_controller' => 'web_profiler.controller.exception:showAction',));
}
// _profiler_exception_css
if (preg_match('#^/_profiler/(?P<token>[^/]++)/exception\\.css$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_exception_css')), array ( '_controller' => 'web_profiler.controller.exception:cssAction',));
}
}
}
// _twig_error_test
if (preg_match('#^/(?P<_locale>en|fr|de|es|cs|nl|ru|uk|ro|pt_BR|pl|it|ja|id|ca)/_error/(?P<code>\\d+)(?:\\.(?P<_format>[^/]++))?$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => '_twig_error_test')), array ( '_controller' => 'twig.controller.preview_error:previewErrorPageAction', '_format' => 'html', '_locale' => 'en',));
}
if (0 === strpos($pathinfo, '/admin/post')) {
// admin_index
if (rtrim($pathinfo, '/') === '/admin/post') {
if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_admin_index;
}
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'admin_index');
}
return array ( '_controller' => 'AppBundle\\Controller\\Admin\\BlogController::indexAction', '_route' => 'admin_index',);
}
not_admin_index:
// admin_post_index
if (rtrim($pathinfo, '/') === '/admin/post') {
if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_admin_post_index;
}
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'admin_post_index');
}
return array ( '_controller' => 'AppBundle\\Controller\\Admin\\BlogController::indexAction', '_route' => 'admin_post_index',);
}
not_admin_post_index:
// admin_post_new
if ($pathinfo === '/admin/post/new') {
if (!in_array($this->context->getMethod(), array('GET', 'POST', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'POST', 'HEAD'));
goto not_admin_post_new;
}
return array ( '_controller' => 'AppBundle\\Controller\\Admin\\BlogController::newAction', '_route' => 'admin_post_new',);
}
not_admin_post_new:
// admin_post_show
if (preg_match('#^/admin/post/(?P<id>\\d+)$#s', $pathinfo, $matches)) {
if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_admin_post_show;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'admin_post_show')), array ( '_controller' => 'AppBundle\\Controller\\Admin\\BlogController::showAction',));
}
not_admin_post_show:
// admin_post_edit
if (preg_match('#^/admin/post/(?P<id>\\d+)/edit$#s', $pathinfo, $matches)) {
if (!in_array($this->context->getMethod(), array('GET', 'POST', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'POST', 'HEAD'));
goto not_admin_post_edit;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'admin_post_edit')), array ( '_controller' => 'AppBundle\\Controller\\Admin\\BlogController::editAction',));
}
not_admin_post_edit:
// admin_post_delete
if (preg_match('#^/admin/post/(?P<id>[^/]++)$#s', $pathinfo, $matches)) {
if ($this->context->getMethod() != 'DELETE') {
$allow[] = 'DELETE';
goto not_admin_post_delete;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'admin_post_delete')), array ( '_controller' => 'AppBundle\\Controller\\Admin\\BlogController::deleteAction',));
}
not_admin_post_delete:
}
if (0 === strpos($pathinfo, '/blog')) {
// blog_index
if (rtrim($pathinfo, '/') === '/blog') {
if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_blog_index;
}
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'blog_index');
}
return array ( 'page' => 1, '_controller' => 'AppBundle\\Controller\\BlogController::indexAction', '_route' => 'blog_index',);
}
not_blog_index:
if (0 === strpos($pathinfo, '/blog/p')) {
// blog_index_paginated
if (0 === strpos($pathinfo, '/blog/page') && preg_match('#^/blog/page/(?P<page>[1-9]\\d*)$#s', $pathinfo, $matches)) {
if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_blog_index_paginated;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'blog_index_paginated')), array ( '_controller' => 'AppBundle\\Controller\\BlogController::indexAction',));
}
not_blog_index_paginated:
// blog_post
if (0 === strpos($pathinfo, '/blog/posts') && preg_match('#^/blog/posts/(?P<slug>[^/]++)$#s', $pathinfo, $matches)) {
if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_blog_post;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'blog_post')), array ( '_controller' => 'AppBundle\\Controller\\BlogController::postShowAction',));
}
not_blog_post:
}
// comment_new
if (0 === strpos($pathinfo, '/blog/comment') && preg_match('#^/blog/comment/(?P<postSlug>[^/]++)/new$#s', $pathinfo, $matches)) {
if ($this->context->getMethod() != 'POST') {
$allow[] = 'POST';
goto not_comment_new;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'comment_new')), array ( '_controller' => 'AppBundle\\Controller\\BlogController::commentNewAction',));
}
not_comment_new:
}
if (0 === strpos($pathinfo, '/log')) {
if (0 === strpos($pathinfo, '/login')) {
// security_login_form
if ($pathinfo === '/login') {
if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_security_login_form;
}
return array ( '_controller' => 'AppBundle\\Controller\\SecurityController::loginAction', '_route' => 'security_login_form',);
}
not_security_login_form:
// security_login_check
if ($pathinfo === '/login_check') {
return array ( '_controller' => 'AppBundle\\Controller\\SecurityController::loginCheckAction', '_route' => 'security_login_check',);
}
}
// security_logout
if ($pathinfo === '/logout') {
return array ( '_controller' => 'AppBundle\\Controller\\SecurityController::logoutAction', '_route' => 'security_logout',);
}
}
// homepage
if (rtrim($pathinfo, '/') === '') {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'homepage');
}
return array ( '_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\TemplateController::templateAction', 'template' => 'default/homepage.html.twig', '_route' => 'homepage',);
}
$host = $this->context->getHost();
if (preg_match('#^idp\\.example\\.com\\:8000$#si', $host, $hostMatches)) {
if (0 === strpos($pathinfo, '/sso/log')) {
// sso_login_path
if (rtrim($pathinfo, '/') === '/sso/login') {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'sso_login_path');
}
return array ( '_controller' => 'Krtv\\Bundle\\SingleSignOnIdentityProviderBundle\\Controller\\SingleSignOnController::ssoLoginAction', '_route' => 'sso_login_path',);
}
// sso_logout_path
if ($pathinfo === '/sso/logout') {
return array ( '_controller' => 'Krtv\\Bundle\\SingleSignOnIdentityProviderBundle\\Controller\\SingleSignOnController::ssoLogoutAction', '_route' => 'sso_logout_path',);
}
}
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment