This commit is contained in:
Torsten 2018-08-07 10:42:11 +02:00
parent 98419bd18d
commit 8a69e45efa
4919 changed files with 28311 additions and 224136 deletions

0
pfosten/vendor/symfony/routing/.gitignore vendored Executable file → Normal file
View file

8
pfosten/vendor/symfony/routing/Annotation/Route.php vendored Executable file → Normal file
View file

@ -32,8 +32,6 @@ class Route
private $condition;
/**
* Constructor.
*
* @param array $data An array of key/value parameters
*
* @throws \BadMethodCallException
@ -48,7 +46,7 @@ class Route
foreach ($data as $key => $value) {
$method = 'set'.str_replace('_', '', $key);
if (!method_exists($this, $method)) {
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, get_class($this)));
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, \get_class($this)));
}
$this->$method($value);
}
@ -116,7 +114,7 @@ class Route
public function setSchemes($schemes)
{
$this->schemes = is_array($schemes) ? $schemes : array($schemes);
$this->schemes = \is_array($schemes) ? $schemes : array($schemes);
}
public function getSchemes()
@ -126,7 +124,7 @@ class Route
public function setMethods($methods)
{
$this->methods = is_array($methods) ? $methods : array($methods);
$this->methods = \is_array($methods) ? $methods : array($methods);
}
public function getMethods()

11
pfosten/vendor/symfony/routing/CHANGELOG.md vendored Executable file → Normal file
View file

@ -1,6 +1,15 @@
CHANGELOG
=========
3.4.0
-----
* Added `NoConfigurationException`.
* Added the possibility to define a prefix for all routes of a controller via @Route(name="prefix_")
* Added support for prioritized routing loaders.
* Add matched and default parameters to redirect responses
* Added support for a `controller` keyword for configuring route controllers in YAML and XML configurations.
3.3.0
-----
@ -19,7 +28,7 @@ CHANGELOG
* Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations.
* Added support for UTF-8 requirements
2.8.0
-----

2
pfosten/vendor/symfony/routing/CompiledRoute.php vendored Executable file → Normal file
View file

@ -28,8 +28,6 @@ class CompiledRoute implements \Serializable
private $hostTokens;
/**
* Constructor.
*
* @param string $staticPrefix The static prefix of the compiled route
* @param string $regex The regular expression to use to match this route
* @param array $tokens An array of tokens to use to generate URL for this route

View file

@ -11,9 +11,10 @@
namespace Symfony\Component\Routing\DependencyInjection;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Adds tagged routing.loader services to routing.resolver service.
@ -22,6 +23,8 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
*/
class RoutingResolverPass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;
private $resolverServiceId;
private $loaderTag;
@ -39,7 +42,7 @@ class RoutingResolverPass implements CompilerPassInterface
$definition = $container->getDefinition($this->resolverServiceId);
foreach ($container->findTaggedServiceIds($this->loaderTag, true) as $id => $attributes) {
foreach ($this->findAndSortTaggedServices($this->loaderTag, $container) as $id) {
$definition->addMethodCall('addLoader', array(new Reference($id)));
}
}

0
pfosten/vendor/symfony/routing/Exception/ExceptionInterface.php vendored Executable file → Normal file
View file

View file

View file

@ -20,9 +20,6 @@ namespace Symfony\Component\Routing\Exception;
*/
class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface
{
/**
* @var array
*/
protected $allowedMethods = array();
public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null)

View file

View file

0
pfosten/vendor/symfony/routing/Exception/RouteNotFoundException.php vendored Executable file → Normal file
View file

View file

8
pfosten/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php vendored Executable file → Normal file
View file

@ -20,16 +20,8 @@ use Symfony\Component\Routing\RouteCollection;
*/
abstract class GeneratorDumper implements GeneratorDumperInterface
{
/**
* @var RouteCollection
*/
private $routes;
/**
* Constructor.
*
* @param RouteCollection $routes The RouteCollection to dump
*/
public function __construct(RouteCollection $routes)
{
$this->routes = $routes;

View file

View file

@ -46,8 +46,6 @@ use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Psr\Log\LoggerInterface;
/**
* {$options['class']}
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
@ -55,9 +53,6 @@ class {$options['class']} extends {$options['base_class']}
{
private static \$declaredRoutes;
/**
* Constructor.
*/
public function __construct(RequestContext \$context, LoggerInterface \$logger = null)
{
\$this->context = \$context;

106
pfosten/vendor/symfony/routing/Generator/UrlGenerator.php vendored Executable file → Normal file
View file

@ -11,12 +11,12 @@
namespace Symfony\Component\Routing\Generator;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Exception\InvalidParameterException;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
use Psr\Log\LoggerInterface;
use Symfony\Component\Routing\Exception\InvalidParameterException;
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
/**
* UrlGenerator can generate a URL or a path for any route in the RouteCollection
@ -27,14 +27,7 @@ use Psr\Log\LoggerInterface;
*/
class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface
{
/**
* @var RouteCollection
*/
protected $routes;
/**
* @var RequestContext
*/
protected $context;
/**
@ -42,9 +35,6 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
*/
protected $strictRequirements = true;
/**
* @var LoggerInterface|null
*/
protected $logger;
/**
@ -75,13 +65,6 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
'%7C' => '|',
);
/**
* Constructor.
*
* @param RouteCollection $routes A RouteCollection instance
* @param RequestContext $context The context
* @param LoggerInterface|null $logger A logger instance
*/
public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null)
{
$this->routes = $routes;
@ -198,59 +181,58 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
}
$schemeAuthority = '';
if ($host = $this->context->getHost()) {
$scheme = $this->context->getScheme();
$host = $this->context->getHost();
$scheme = $this->context->getScheme();
if ($requiredSchemes) {
if (!in_array($scheme, $requiredSchemes, true)) {
$referenceType = self::ABSOLUTE_URL;
$scheme = current($requiredSchemes);
}
if ($requiredSchemes) {
if (!\in_array($scheme, $requiredSchemes, true)) {
$referenceType = self::ABSOLUTE_URL;
$scheme = current($requiredSchemes);
}
}
if ($hostTokens) {
$routeHost = '';
foreach ($hostTokens as $token) {
if ('variable' === $token[0]) {
if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) {
if ($this->strictRequirements) {
throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]])));
}
if ($this->logger) {
$this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]));
}
return;
if ($hostTokens) {
$routeHost = '';
foreach ($hostTokens as $token) {
if ('variable' === $token[0]) {
if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i'.(empty($token[4]) ? '' : 'u'), $mergedParams[$token[3]])) {
if ($this->strictRequirements) {
throw new InvalidParameterException(strtr($message, array('{parameter}' => $token[3], '{route}' => $name, '{expected}' => $token[2], '{given}' => $mergedParams[$token[3]])));
}
$routeHost = $token[1].$mergedParams[$token[3]].$routeHost;
} else {
$routeHost = $token[1].$routeHost;
}
}
if ($this->logger) {
$this->logger->error($message, array('parameter' => $token[3], 'route' => $name, 'expected' => $token[2], 'given' => $mergedParams[$token[3]]));
}
if ($routeHost !== $host) {
$host = $routeHost;
if (self::ABSOLUTE_URL !== $referenceType) {
$referenceType = self::NETWORK_PATH;
return;
}
$routeHost = $token[1].$mergedParams[$token[3]].$routeHost;
} else {
$routeHost = $token[1].$routeHost;
}
}
if (self::ABSOLUTE_URL === $referenceType || self::NETWORK_PATH === $referenceType) {
$port = '';
if ('http' === $scheme && 80 != $this->context->getHttpPort()) {
$port = ':'.$this->context->getHttpPort();
} elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) {
$port = ':'.$this->context->getHttpsPort();
if ($routeHost !== $host) {
$host = $routeHost;
if (self::ABSOLUTE_URL !== $referenceType) {
$referenceType = self::NETWORK_PATH;
}
$schemeAuthority = self::NETWORK_PATH === $referenceType ? '//' : "$scheme://";
$schemeAuthority .= $host.$port;
}
}
if ((self::ABSOLUTE_URL === $referenceType || self::NETWORK_PATH === $referenceType) && !empty($host)) {
$port = '';
if ('http' === $scheme && 80 != $this->context->getHttpPort()) {
$port = ':'.$this->context->getHttpPort();
} elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) {
$port = ':'.$this->context->getHttpsPort();
}
$schemeAuthority = self::NETWORK_PATH === $referenceType ? '//' : "$scheme://";
$schemeAuthority .= $host.$port;
}
if (self::RELATIVE_PATH === $referenceType) {
$url = self::getRelativePath($this->context->getPathInfo(), $url);
} else {
@ -326,7 +308,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
}
$targetDirs[] = $targetFile;
$path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs);
$path = str_repeat('../', \count($sourceDirs)).implode('/', $targetDirs);
// A reference to the same base directory or an empty subdirectory must be prefixed with "./".
// This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used

0
pfosten/vendor/symfony/routing/Generator/UrlGeneratorInterface.php vendored Executable file → Normal file
View file

2
pfosten/vendor/symfony/routing/LICENSE vendored Executable file → Normal file
View file

@ -1,4 +1,4 @@
Copyright (c) 2004-2017 Fabien Potencier
Copyright (c) 2004-2018 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

32
pfosten/vendor/symfony/routing/Loader/AnnotationClassLoader.php vendored Executable file → Normal file
View file

@ -12,11 +12,11 @@
namespace Symfony\Component\Routing\Loader;
use Doctrine\Common\Annotations\Reader;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
/**
* AnnotationClassLoader loads routing information from a PHP class and its methods.
@ -57,9 +57,6 @@ use Symfony\Component\Config\Loader\LoaderResolverInterface;
*/
abstract class AnnotationClassLoader implements LoaderInterface
{
/**
* @var Reader
*/
protected $reader;
/**
@ -72,11 +69,6 @@ abstract class AnnotationClassLoader implements LoaderInterface
*/
protected $defaultRouteIndex = 0;
/**
* Constructor.
*
* @param Reader $reader
*/
public function __construct(Reader $reader)
{
$this->reader = $reader;
@ -127,9 +119,15 @@ abstract class AnnotationClassLoader implements LoaderInterface
}
}
if (0 === $collection->count() && $class->hasMethod('__invoke') && $annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) {
$globals['path'] = '';
$this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke'));
if (0 === $collection->count() && $class->hasMethod('__invoke')) {
foreach ($this->reader->getClassAnnotations($class) as $annot) {
if ($annot instanceof $this->routeAnnotationClass) {
$globals['path'] = '';
$globals['name'] = '';
$this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke'));
}
}
}
return $collection;
@ -141,6 +139,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
if (null === $name) {
$name = $this->getDefaultRouteName($class, $method);
}
$name = $globals['name'].$name;
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
foreach ($method->getParameters() as $param) {
@ -175,7 +174,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
*/
public function supports($resource, $type = null)
{
return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
}
/**
@ -222,9 +221,14 @@ abstract class AnnotationClassLoader implements LoaderInterface
'methods' => array(),
'host' => '',
'condition' => '',
'name' => '',
);
if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) {
if (null !== $annot->getName()) {
$globals['name'] = $annot->getName();
}
if (null !== $annot->getPath()) {
$globals['path'] = $annot->getPath();
}

16
pfosten/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php vendored Executable file → Normal file
View file

@ -11,8 +11,8 @@
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Routing\RouteCollection;
/**
* AnnotationDirectoryLoader loads routing information from annotations set
@ -34,7 +34,9 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
*/
public function load($path, $type = null)
{
$dir = $this->locator->locate($path);
if (!is_dir($dir = $this->locator->locate($path))) {
return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection();
}
$collection = new RouteCollection();
$collection->addResource(new DirectoryResource($dir, '/\.php$/'));
@ -74,16 +76,18 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
*/
public function supports($resource, $type = null)
{
if (!is_string($resource)) {
if ('annotation' === $type) {
return true;
}
if ($type || !\is_string($resource)) {
return false;
}
try {
$path = $this->locator->locate($resource);
return is_dir($this->locator->locate($resource));
} catch (\Exception $e) {
return false;
}
return is_dir($path) && (!$type || 'annotation' === $type);
}
}

31
pfosten/vendor/symfony/routing/Loader/AnnotationFileLoader.php vendored Executable file → Normal file
View file

@ -11,10 +11,10 @@
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\FileLocatorInterface;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\RouteCollection;
/**
* AnnotationFileLoader loads routing information from annotations set
@ -27,16 +27,11 @@ class AnnotationFileLoader extends FileLoader
protected $loader;
/**
* Constructor.
*
* @param FileLocatorInterface $locator A FileLocator instance
* @param AnnotationClassLoader $loader An AnnotationClassLoader instance
*
* @throws \RuntimeException
*/
public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader)
{
if (!function_exists('token_get_all')) {
if (!\function_exists('token_get_all')) {
throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.');
}
@ -77,7 +72,7 @@ class AnnotationFileLoader extends FileLoader
*/
public function supports($resource, $type = null)
{
return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
}
/**
@ -93,7 +88,7 @@ class AnnotationFileLoader extends FileLoader
$namespace = false;
$tokens = token_get_all(file_get_contents($file));
if (1 === count($tokens) && T_INLINE_HTML === $tokens[0][0]) {
if (1 === \count($tokens) && T_INLINE_HTML === $tokens[0][0]) {
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the "<?php" start tag at the beginning of the file?', $file));
}
@ -110,29 +105,29 @@ class AnnotationFileLoader extends FileLoader
if (true === $namespace && T_STRING === $token[0]) {
$namespace = $token[1];
while (isset($tokens[++$i][1]) && in_array($tokens[$i][0], array(T_NS_SEPARATOR, T_STRING))) {
while (isset($tokens[++$i][1]) && \in_array($tokens[$i][0], array(T_NS_SEPARATOR, T_STRING))) {
$namespace .= $tokens[$i][1];
}
$token = $tokens[$i];
}
if (T_CLASS === $token[0]) {
// Skip usage of ::class constant
$isClassConstant = false;
// Skip usage of ::class constant and anonymous classes
$skipClassToken = false;
for ($j = $i - 1; $j > 0; --$j) {
if (!isset($tokens[$j][1])) {
break;
}
if (T_DOUBLE_COLON === $tokens[$j][0]) {
$isClassConstant = true;
if (T_DOUBLE_COLON === $tokens[$j][0] || T_NEW === $tokens[$j][0]) {
$skipClassToken = true;
break;
} elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
} elseif (!\in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
break;
}
}
if (!$isClassConstant) {
if (!$skipClassToken) {
$class = true;
}
}

0
pfosten/vendor/symfony/routing/Loader/ClosureLoader.php vendored Executable file → Normal file
View file

View file

2
pfosten/vendor/symfony/routing/Loader/DirectoryLoader.php vendored Executable file → Normal file
View file

@ -12,8 +12,8 @@
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Routing\RouteCollection;
class DirectoryLoader extends FileLoader
{

14
pfosten/vendor/symfony/routing/Loader/ObjectRouteLoader.php vendored Executable file → Normal file
View file

@ -45,7 +45,7 @@ abstract class ObjectRouteLoader extends Loader
public function load($resource, $type = null)
{
$parts = explode(':', $resource);
if (count($parts) != 2) {
if (2 != \count($parts)) {
throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName"', $resource));
}
@ -54,20 +54,20 @@ abstract class ObjectRouteLoader extends Loader
$loaderObject = $this->getServiceObject($serviceString);
if (!is_object($loaderObject)) {
throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', get_class($this), gettype($loaderObject)));
if (!\is_object($loaderObject)) {
throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject)));
}
if (!method_exists($loaderObject, $method)) {
throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, get_class($loaderObject), $resource));
throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, \get_class($loaderObject), $resource));
}
$routeCollection = call_user_func(array($loaderObject, $method), $this);
$routeCollection = \call_user_func(array($loaderObject, $method), $this);
if (!$routeCollection instanceof RouteCollection) {
$type = is_object($routeCollection) ? get_class($routeCollection) : gettype($routeCollection);
$type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', get_class($loaderObject), $method, $type));
throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', \get_class($loaderObject), $method, $type));
}
// make the service file tracked so that if it changes, the cache rebuilds

41
pfosten/vendor/symfony/routing/Loader/PhpFileLoader.php vendored Executable file → Normal file
View file

@ -13,6 +13,7 @@ namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Symfony\Component\Routing\RouteCollection;
/**
@ -35,9 +36,23 @@ class PhpFileLoader extends FileLoader
public function load($file, $type = null)
{
$path = $this->locator->locate($file);
$this->setCurrentDir(dirname($path));
$this->setCurrentDir(\dirname($path));
// the closure forbids access to the private scope in the included file
$loader = $this;
$load = \Closure::bind(function ($file) use ($loader) {
return include $file;
}, null, ProtectedPhpFileLoader::class);
$result = $load($path);
if ($result instanceof \Closure) {
$collection = new RouteCollection();
$result(new RoutingConfigurator($collection, $this, $path, $file), $this);
} else {
$collection = $result;
}
$collection = self::includeFile($path, $this);
$collection->addResource(new FileResource($path));
return $collection;
@ -48,19 +63,13 @@ class PhpFileLoader extends FileLoader
*/
public function supports($resource, $type = null)
{
return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type);
}
/**
* Safe include. Used for scope isolation.
*
* @param string $file File to include
* @param PhpFileLoader $loader the loader variable is exposed to the included file below
*
* @return RouteCollection
*/
private static function includeFile($file, PhpFileLoader $loader)
{
return include $file;
return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type);
}
}
/**
* @internal
*/
final class ProtectedPhpFileLoader extends PhpFileLoader
{
}

71
pfosten/vendor/symfony/routing/Loader/XmlFileLoader.php vendored Executable file → Normal file
View file

@ -11,11 +11,11 @@
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\Util\XmlUtils;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* XmlFileLoader loads XML routing files.
@ -36,8 +36,8 @@ class XmlFileLoader extends FileLoader
*
* @return RouteCollection A RouteCollection instance
*
* @throws \InvalidArgumentException When the file cannot be loaded or when the XML cannot be
* parsed because it does not validate against the scheme.
* @throws \InvalidArgumentException when the file cannot be loaded or when the XML cannot be
* parsed because it does not validate against the scheme
*/
public function load($file, $type = null)
{
@ -93,7 +93,7 @@ class XmlFileLoader extends FileLoader
*/
public function supports($resource, $type = null)
{
return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
return \is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
}
/**
@ -144,28 +144,35 @@ class XmlFileLoader extends FileLoader
list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path);
$this->setCurrentDir(dirname($path));
$this->setCurrentDir(\dirname($path));
$subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file);
/* @var $subCollection RouteCollection */
$subCollection->addPrefix($prefix);
if (null !== $host) {
$subCollection->setHost($host);
}
if (null !== $condition) {
$subCollection->setCondition($condition);
}
if (null !== $schemes) {
$subCollection->setSchemes($schemes);
}
if (null !== $methods) {
$subCollection->setMethods($methods);
}
$subCollection->addDefaults($defaults);
$subCollection->addRequirements($requirements);
$subCollection->addOptions($options);
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file);
$collection->addCollection($subCollection);
if (!\is_array($imported)) {
$imported = array($imported);
}
foreach ($imported as $subCollection) {
/* @var $subCollection RouteCollection */
$subCollection->addPrefix($prefix);
if (null !== $host) {
$subCollection->setHost($host);
}
if (null !== $condition) {
$subCollection->setCondition($condition);
}
if (null !== $schemes) {
$subCollection->setSchemes($schemes);
}
if (null !== $methods) {
$subCollection->setMethods($methods);
}
$subCollection->addDefaults($defaults);
$subCollection->addRequirements($requirements);
$subCollection->addOptions($options);
$collection->addCollection($subCollection);
}
}
/**
@ -225,10 +232,20 @@ class XmlFileLoader extends FileLoader
$condition = trim($n->textContent);
break;
default:
throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement" or "option".', $n->localName, $path));
throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement", "option" or "condition".', $n->localName, $path));
}
}
if ($controller = $node->getAttribute('controller')) {
if (isset($defaults['_controller'])) {
$name = $node->hasAttribute('id') ? sprintf('"%s"', $node->getAttribute('id')) : sprintf('the "%s" tag', $node->tagName);
throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "controller" attribute and the defaults key "_controller" for %s.', $path, $name));
}
$defaults['_controller'] = $controller;
}
return array($defaults, $requirements, $options, $condition);
}

83
pfosten/vendor/symfony/routing/Loader/YamlFileLoader.php vendored Executable file → Normal file
View file

@ -11,13 +11,12 @@
namespace Symfony\Component\Routing\Loader;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser as YamlParser;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Yaml\Yaml;
/**
* YamlFileLoader loads Yaml routing files.
@ -28,7 +27,7 @@ use Symfony\Component\Yaml\Yaml;
class YamlFileLoader extends FileLoader
{
private static $availableKeys = array(
'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition',
'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller',
);
private $yamlParser;
@ -58,10 +57,18 @@ class YamlFileLoader extends FileLoader
$this->yamlParser = new YamlParser();
}
$prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($file, &$prevErrorHandler) {
$message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$file.'"$0', $message) : $message;
return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false;
});
try {
$parsedConfig = $this->yamlParser->parse(file_get_contents($path), Yaml::PARSE_KEYS_AS_STRINGS);
$parsedConfig = $this->yamlParser->parseFile($path);
} catch (ParseException $e) {
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
} finally {
restore_error_handler();
}
$collection = new RouteCollection();
@ -73,7 +80,7 @@ class YamlFileLoader extends FileLoader
}
// not an array
if (!is_array($parsedConfig)) {
if (!\is_array($parsedConfig)) {
throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path));
}
@ -95,7 +102,7 @@ class YamlFileLoader extends FileLoader
*/
public function supports($resource, $type = null)
{
return is_string($resource) && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type);
return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type);
}
/**
@ -116,6 +123,10 @@ class YamlFileLoader extends FileLoader
$methods = isset($config['methods']) ? $config['methods'] : array();
$condition = isset($config['condition']) ? $config['condition'] : null;
if (isset($config['controller'])) {
$defaults['_controller'] = $config['controller'];
}
$route = new Route($config['path'], $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
$collection->add($name, $route);
@ -141,28 +152,39 @@ class YamlFileLoader extends FileLoader
$schemes = isset($config['schemes']) ? $config['schemes'] : null;
$methods = isset($config['methods']) ? $config['methods'] : null;
$this->setCurrentDir(dirname($path));
if (isset($config['controller'])) {
$defaults['_controller'] = $config['controller'];
}
$subCollection = $this->import($config['resource'], $type, false, $file);
/* @var $subCollection RouteCollection */
$subCollection->addPrefix($prefix);
if (null !== $host) {
$subCollection->setHost($host);
}
if (null !== $condition) {
$subCollection->setCondition($condition);
}
if (null !== $schemes) {
$subCollection->setSchemes($schemes);
}
if (null !== $methods) {
$subCollection->setMethods($methods);
}
$subCollection->addDefaults($defaults);
$subCollection->addRequirements($requirements);
$subCollection->addOptions($options);
$this->setCurrentDir(\dirname($path));
$collection->addCollection($subCollection);
$imported = $this->import($config['resource'], $type, false, $file);
if (!\is_array($imported)) {
$imported = array($imported);
}
foreach ($imported as $subCollection) {
/* @var $subCollection RouteCollection */
$subCollection->addPrefix($prefix);
if (null !== $host) {
$subCollection->setHost($host);
}
if (null !== $condition) {
$subCollection->setCondition($condition);
}
if (null !== $schemes) {
$subCollection->setSchemes($schemes);
}
if (null !== $methods) {
$subCollection->setMethods($methods);
}
$subCollection->addDefaults($defaults);
$subCollection->addRequirements($requirements);
$subCollection->addOptions($options);
$collection->addCollection($subCollection);
}
}
/**
@ -177,7 +199,7 @@ class YamlFileLoader extends FileLoader
*/
protected function validate($config, $name, $path)
{
if (!is_array($config)) {
if (!\is_array($config)) {
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
}
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
@ -204,5 +226,8 @@ class YamlFileLoader extends FileLoader
$name, $path
));
}
if (isset($config['controller']) && isset($config['defaults']['_controller'])) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "controller" key and the defaults key "_controller" for "%s".', $path, $name));
}
}
}

View file

@ -41,6 +41,7 @@
<xsd:attribute name="host" type="xsd:string" />
<xsd:attribute name="schemes" type="xsd:string" />
<xsd:attribute name="methods" type="xsd:string" />
<xsd:attribute name="controller" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="import">
@ -52,6 +53,7 @@
<xsd:attribute name="host" type="xsd:string" />
<xsd:attribute name="schemes" type="xsd:string" />
<xsd:attribute name="methods" type="xsd:string" />
<xsd:attribute name="controller" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="default" mixed="true">

4
pfosten/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php vendored Executable file → Normal file
View file

@ -105,10 +105,8 @@ class DumperCollection implements \IteratorAggregate
/**
* Sets the parent collection.
*
* @param DumperCollection $parent The parent collection
*/
protected function setParent(DumperCollection $parent)
protected function setParent(self $parent)
{
$this->parent = $parent;
}

9
pfosten/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php vendored Executable file → Normal file
View file

@ -22,19 +22,10 @@ use Symfony\Component\Routing\Route;
*/
class DumperRoute
{
/**
* @var string
*/
private $name;
/**
* @var Route
*/
private $route;
/**
* Constructor.
*
* @param string $name The route name
* @param Route $route The route
*/

8
pfosten/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php vendored Executable file → Normal file
View file

@ -20,16 +20,8 @@ use Symfony\Component\Routing\RouteCollection;
*/
abstract class MatcherDumper implements MatcherDumperInterface
{
/**
* @var RouteCollection
*/
private $routes;
/**
* Constructor.
*
* @param RouteCollection $routes The RouteCollection to dump
*/
public function __construct(RouteCollection $routes)
{
$this->routes = $routes;

View file

192
pfosten/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php vendored Executable file → Normal file
View file

@ -11,10 +11,10 @@
namespace Symfony\Component\Routing\Matcher\Dumper;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
/**
* PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes.
@ -63,16 +63,11 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* {$options['class']}.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class {$options['class']} extends {$options['base_class']}
{
/**
* Constructor.
*/
public function __construct(RequestContext \$context)
{
\$this->context = \$context;
@ -101,21 +96,19 @@ EOF;
$code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n");
return <<<EOF
public function match(\$pathinfo)
public function match(\$rawPathinfo)
{
\$allow = array();
\$pathinfo = rawurldecode(\$pathinfo);
\$pathinfo = rawurldecode(\$rawPathinfo);
\$trimmedPathinfo = rtrim(\$pathinfo, '/');
\$context = \$this->context;
\$request = \$this->request;
\$request = \$this->request ?: \$this->createRequest(\$pathinfo);
\$requestMethod = \$canonicalMethod = \$context->getMethod();
\$scheme = \$context->getScheme();
if ('HEAD' === \$requestMethod) {
\$canonicalMethod = 'GET';
}
$code
throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new ResourceNotFoundException();
@ -160,6 +153,11 @@ EOF;
}
}
// used to display the Welcome Page in apps that don't define a homepage
$code .= " if ('/' === \$pathinfo && !\$allow) {\n";
$code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
$code .= " }\n";
return $code;
}
@ -182,7 +180,7 @@ EOF;
*
* @param StaticPrefixCollection $collection A StaticPrefixCollection instance
* @param bool $supportsRedirections Whether redirections are supported by the base class
* @param string $ifOrElseIf Either "if" or "elseif" to influence chaining.
* @param string $ifOrElseIf either "if" or "elseif" to influence chaining
*
* @return string PHP code
*/
@ -238,11 +236,11 @@ EOF;
$hostMatches = false;
$methods = $route->getMethods();
$supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('HEAD', $methods) || in_array('GET', $methods));
$supportsTrailingSlash = $supportsRedirections && (!$methods || \in_array('GET', $methods));
$regex = $compiledRoute->getRegex();
if (!count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P<url>.*?)\$\1#'.(substr($regex, -1) === 'u' ? 'u' : ''), $regex, $m)) {
if ($supportsTrailingSlash && substr($m['url'], -1) === '/') {
if (!\count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P<url>.*?)\$\1#'.('u' === substr($regex, -1) ? 'u' : ''), $regex, $m)) {
if ($supportsTrailingSlash && '/' === substr($m['url'], -1)) {
$conditions[] = sprintf('%s === $trimmedPathinfo', var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true));
$hasTrailingSlash = true;
} else {
@ -280,83 +278,8 @@ EOF;
$gotoname = 'not_'.preg_replace('/[^A-Za-z0-9_]/', '', $name);
if ($methods) {
if (1 === count($methods)) {
if ($methods[0] === 'HEAD') {
$code .= <<<EOF
if ('HEAD' !== \$requestMethod) {
\$allow[] = 'HEAD';
goto $gotoname;
}
EOF;
} else {
$code .= <<<EOF
if ('$methods[0]' !== \$canonicalMethod) {
\$allow[] = '$methods[0]';
goto $gotoname;
}
EOF;
}
} else {
$methodVariable = 'requestMethod';
if (in_array('GET', $methods)) {
// Since we treat HEAD requests like GET requests we don't need to match it.
$methodVariable = 'canonicalMethod';
$methods = array_filter($methods, function ($method) { return 'HEAD' !== $method; });
}
if (1 === count($methods)) {
$code .= <<<EOF
if ('$methods[0]' !== \$$methodVariable) {
\$allow[] = '$methods[0]';
goto $gotoname;
}
EOF;
} else {
$methods = implode("', '", $methods);
$code .= <<<EOF
if (!in_array(\$$methodVariable, array('$methods'))) {
\$allow = array_merge(\$allow, array('$methods'));
goto $gotoname;
}
EOF;
}
}
}
if ($hasTrailingSlash) {
$code .= <<<EOF
if (substr(\$pathinfo, -1) !== '/') {
return \$this->redirect(\$pathinfo.'/', '$name');
}
EOF;
}
if ($schemes = $route->getSchemes()) {
if (!$supportsRedirections) {
throw new \LogicException('The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.');
}
$schemes = str_replace("\n", '', var_export(array_flip($schemes), true));
$code .= <<<EOF
\$requiredSchemes = $schemes;
if (!isset(\$requiredSchemes[\$scheme])) {
return \$this->redirect(\$pathinfo, '$name', key(\$requiredSchemes));
}
EOF;
}
// the offset where the return value is appended below, with indendation
$retOffset = 12 + \strlen($code);
// optimize parameters array
if ($matches || $hostMatches) {
@ -370,18 +293,93 @@ EOF;
$vars[] = "array('_route' => '$name')";
$code .= sprintf(
" return \$this->mergeDefaults(array_replace(%s), %s);\n",
" \$ret = \$this->mergeDefaults(array_replace(%s), %s);\n",
implode(', ', $vars),
str_replace("\n", '', var_export($route->getDefaults(), true))
);
} elseif ($route->getDefaults()) {
$code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true)));
$code .= sprintf(" \$ret = %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true)));
} else {
$code .= sprintf(" return array('_route' => '%s');\n", $name);
$code .= sprintf(" \$ret = array('_route' => '%s');\n", $name);
}
if ($hasTrailingSlash) {
$code .= <<<EOF
if ('/' === substr(\$pathinfo, -1)) {
// no-op
} elseif ('GET' !== \$canonicalMethod) {
goto $gotoname;
} else {
return array_replace(\$ret, \$this->redirect(\$rawPathinfo.'/', '$name'));
}
EOF;
}
if ($methods) {
$methodVariable = \in_array('GET', $methods) ? '$canonicalMethod' : '$requestMethod';
$methods = implode("', '", $methods);
}
if ($schemes = $route->getSchemes()) {
if (!$supportsRedirections) {
throw new \LogicException('The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.');
}
$schemes = str_replace("\n", '', var_export(array_flip($schemes), true));
if ($methods) {
$code .= <<<EOF
\$requiredSchemes = $schemes;
\$hasRequiredScheme = isset(\$requiredSchemes[\$context->getScheme()]);
if (!in_array($methodVariable, array('$methods'))) {
if (\$hasRequiredScheme) {
\$allow = array_merge(\$allow, array('$methods'));
}
goto $gotoname;
}
if (!\$hasRequiredScheme) {
if ('GET' !== \$canonicalMethod) {
goto $gotoname;
}
return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes)));
}
EOF;
} else {
$code .= <<<EOF
\$requiredSchemes = $schemes;
if (!isset(\$requiredSchemes[\$context->getScheme()])) {
if ('GET' !== \$canonicalMethod) {
goto $gotoname;
}
return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes)));
}
EOF;
}
} elseif ($methods) {
$code .= <<<EOF
if (!in_array($methodVariable, array('$methods'))) {
\$allow = array_merge(\$allow, array('$methods'));
goto $gotoname;
}
EOF;
}
if ($hasTrailingSlash || $schemes || $methods) {
$code .= " return \$ret;\n";
} else {
$code = substr_replace($code, 'return', $retOffset, 6);
}
$code .= " }\n";
if ($methods) {
if ($hasTrailingSlash || $schemes || $methods) {
$code .= " $gotoname:\n";
}

View file

@ -69,7 +69,7 @@ class StaticPrefixCollection
// This is needed because otherwise routes that come afterwards have higher precedence
// than a possible regular expression, which goes against the input order sorting.
$this->items[] = array($prefix, $route);
$this->matchStart = count($this->items);
$this->matchStart = \count($this->items);
return;
}
@ -139,7 +139,7 @@ class StaticPrefixCollection
*/
private function accepts($prefix)
{
return '' === $this->prefix || strpos($prefix, $this->prefix) === 0;
return '' === $this->prefix || 0 === strpos($prefix, $this->prefix);
}
/**
@ -152,9 +152,9 @@ class StaticPrefixCollection
*/
private function detectCommonPrefix($prefix, $anotherPrefix)
{
$baseLength = strlen($this->prefix);
$baseLength = \strlen($this->prefix);
$commonLength = $baseLength;
$end = min(strlen($prefix), strlen($anotherPrefix));
$end = min(\strlen($prefix), \strlen($anotherPrefix));
for ($i = $baseLength; $i <= $end; ++$i) {
if (substr($prefix, 0, $i) !== substr($anotherPrefix, 0, $i)) {
@ -166,7 +166,7 @@ class StaticPrefixCollection
$commonPrefix = rtrim(substr($prefix, 0, $commonLength), '/');
if (strlen($commonPrefix) > $baseLength) {
if (\strlen($commonPrefix) > $baseLength) {
return $commonPrefix;
}
@ -201,7 +201,7 @@ class StaticPrefixCollection
private function shouldBeInlined()
{
if (count($this->items) >= 3) {
if (\count($this->items) >= 3) {
return false;
}
@ -212,7 +212,7 @@ class StaticPrefixCollection
}
foreach ($this->items as $item) {
if (is_array($item) && $item[0] === $this->prefix) {
if (\is_array($item) && $item[0] === $this->prefix) {
return false;
}
}
@ -225,7 +225,7 @@ class StaticPrefixCollection
*
* @param string $prefix
*
* @throws \LogicException When a prefix does not belong in a group.
* @throws \LogicException when a prefix does not belong in a group
*/
private function guardAgainstAddingNotAcceptedRoutes($prefix)
{

8
pfosten/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php vendored Executable file → Normal file
View file

@ -27,14 +27,14 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable
try {
$parameters = parent::match($pathinfo);
} catch (ResourceNotFoundException $e) {
if ('/' === substr($pathinfo, -1) || !in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
if ('/' === substr($pathinfo, -1) || !\in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
throw $e;
}
try {
parent::match($pathinfo.'/');
$parameters = parent::match($pathinfo.'/');
return $this->redirect($pathinfo.'/', null);
return array_replace($parameters, $this->redirect($pathinfo.'/', isset($parameters['_route']) ? $parameters['_route'] : null));
} catch (ResourceNotFoundException $e2) {
throw $e;
}
@ -49,7 +49,7 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable
protected function handleRouteRequirements($pathinfo, $name, Route $route)
{
// expression condition
if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request))) {
if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) {
return array(self::REQUIREMENT_MISMATCH, null);
}

View file

6
pfosten/vendor/symfony/routing/Matcher/RequestMatcherInterface.php vendored Executable file → Normal file
View file

@ -12,8 +12,9 @@
namespace Symfony\Component\Routing\Matcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\NoConfigurationException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
/**
* RequestMatcherInterface is the interface that all request matcher classes must implement.
@ -28,10 +29,9 @@ interface RequestMatcherInterface
* If the matcher can not find information, it must throw one of the exceptions documented
* below.
*
* @param Request $request The request to match
*
* @return array An array of parameters
*
* @throws NoConfigurationException If no routing configuration could be found
* @throws ResourceNotFoundException If no matching resource could be found
* @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed
*/

6
pfosten/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php vendored Executable file → Normal file
View file

@ -69,7 +69,7 @@ class TraceableUrlMatcher extends UrlMatcher
$r = new Route($route->getPath(), $route->getDefaults(), array($n => $regex), $route->getOptions());
$cr = $r->compile();
if (in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) {
if (\in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) {
$this->addTrace(sprintf('Requirement for "%s" does not match (%s)', $n, $regex), self::ROUTE_ALMOST_MATCHES, $name, $route);
continue 2;
@ -94,7 +94,7 @@ class TraceableUrlMatcher extends UrlMatcher
$method = 'GET';
}
if (!in_array($method, $requiredMethods)) {
if (!\in_array($method, $requiredMethods)) {
$this->allow = array_merge($this->allow, $requiredMethods);
$this->addTrace(sprintf('Method "%s" does not match any of the required methods (%s)', $this->context->getMethod(), implode(', ', $requiredMethods)), self::ROUTE_ALMOST_MATCHES, $name, $route);
@ -105,7 +105,7 @@ class TraceableUrlMatcher extends UrlMatcher
// check condition
if ($condition = $route->getCondition()) {
if (!$this->getExpressionLanguage()->evaluate($condition, array('context' => $this->context, 'request' => $this->request))) {
if (!$this->getExpressionLanguage()->evaluate($condition, array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) {
$this->addTrace(sprintf('Condition "%s" does not evaluate to "true"', $condition), self::ROUTE_ALMOST_MATCHES, $name, $route);
continue;

77
pfosten/vendor/symfony/routing/Matcher/UrlMatcher.php vendored Executable file → Normal file
View file

@ -11,14 +11,15 @@
namespace Symfony\Component\Routing\Matcher;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\NoConfigurationException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Component\Routing\RouteCollection;
/**
* UrlMatcher matches URL based on a set of routes.
@ -31,21 +32,9 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
const REQUIREMENT_MISMATCH = 1;
const ROUTE_MATCH = 2;
/**
* @var RequestContext
*/
protected $context;
/**
* @var array
*/
protected $allow = array();
/**
* @var RouteCollection
*/
protected $routes;
protected $request;
protected $expressionLanguage;
@ -54,12 +43,6 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
*/
protected $expressionLanguageProviders = array();
/**
* Constructor.
*
* @param RouteCollection $routes A RouteCollection instance
* @param RequestContext $context The context
*/
public function __construct(RouteCollection $routes, RequestContext $context)
{
$this->routes = $routes;
@ -93,7 +76,11 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
return $ret;
}
throw 0 < count($this->allow)
if ('/' === $pathinfo && !$this->allow) {
throw new NoConfigurationException();
}
throw 0 < \count($this->allow)
? new MethodNotAllowedException(array_unique($this->allow))
: new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo));
}
@ -125,6 +112,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
*
* @return array An array of parameters
*
* @throws NoConfigurationException If no routing configuration could be found
* @throws ResourceNotFoundException If the resource could not be found
* @throws MethodNotAllowedException If the resource was found but the request method is not allowed
*/
@ -147,6 +135,12 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
continue;
}
$status = $this->handleRouteRequirements($pathinfo, $name, $route);
if (self::REQUIREMENT_MISMATCH === $status[0]) {
continue;
}
// check HTTP method requirement
if ($requiredMethods = $route->getMethods()) {
// HEAD and GET are equivalent as per RFC
@ -154,24 +148,16 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
$method = 'GET';
}
if (!in_array($method, $requiredMethods)) {
$this->allow = array_merge($this->allow, $requiredMethods);
if (!\in_array($method, $requiredMethods)) {
if (self::REQUIREMENT_MATCH === $status[0]) {
$this->allow = array_merge($this->allow, $requiredMethods);
}
continue;
}
}
$status = $this->handleRouteRequirements($pathinfo, $name, $route);
if (self::ROUTE_MATCH === $status[0]) {
return $status[1];
}
if (self::REQUIREMENT_MISMATCH === $status[0]) {
continue;
}
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches));
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : array()));
}
}
@ -207,7 +193,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
protected function handleRouteRequirements($pathinfo, $name, Route $route)
{
// expression condition
if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request))) {
if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) {
return array(self::REQUIREMENT_MISMATCH, null);
}
@ -229,7 +215,7 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
protected function mergeDefaults($params, $defaults)
{
foreach ($params as $key => $value) {
if (!is_int($key)) {
if (!\is_int($key)) {
$defaults[$key] = $value;
}
}
@ -248,4 +234,19 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
return $this->expressionLanguage;
}
/**
* @internal
*/
protected function createRequest($pathinfo)
{
if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
return null;
}
return Request::create($this->context->getScheme().'://'.$this->context->getHost().$this->context->getBaseUrl().$pathinfo, $this->context->getMethod(), $this->context->getParameters(), array(), array(), array(
'SCRIPT_FILENAME' => $this->context->getBaseUrl(),
'SCRIPT_NAME' => $this->context->getBaseUrl(),
));
}
}

6
pfosten/vendor/symfony/routing/Matcher/UrlMatcherInterface.php vendored Executable file → Normal file
View file

@ -11,9 +11,10 @@
namespace Symfony\Component\Routing\Matcher;
use Symfony\Component\Routing\RequestContextAwareInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\NoConfigurationException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContextAwareInterface;
/**
* UrlMatcherInterface is the interface that all URL matcher classes must implement.
@ -32,6 +33,7 @@ interface UrlMatcherInterface extends RequestContextAwareInterface
*
* @return array An array of parameters
*
* @throws NoConfigurationException If no routing configuration could be found
* @throws ResourceNotFoundException If the resource could not be found
* @throws MethodNotAllowedException If the resource was found but the request method is not allowed
*/

0
pfosten/vendor/symfony/routing/README.md vendored Executable file → Normal file
View file

8
pfosten/vendor/symfony/routing/RequestContext.php vendored Executable file → Normal file
View file

@ -31,15 +31,9 @@ class RequestContext
private $httpPort;
private $httpsPort;
private $queryString;
/**
* @var array
*/
private $parameters = array();
/**
* Constructor.
*
* @param string $baseUrl The base URL
* @param string $method The HTTP method
* @param string $host The HTTP host name
@ -64,8 +58,6 @@ class RequestContext
/**
* Updates the RequestContext information based on a HttpFoundation Request.
*
* @param Request $request A Request instance
*
* @return $this
*/
public function fromRequest(Request $request)

2
pfosten/vendor/symfony/routing/RequestContextAwareInterface.php vendored Executable file → Normal file
View file

@ -15,8 +15,6 @@ interface RequestContextAwareInterface
{
/**
* Sets the request context.
*
* @param RequestContext $context The context
*/
public function setContext(RequestContext $context);

67
pfosten/vendor/symfony/routing/Route.php vendored Executable file → Normal file
View file

@ -19,51 +19,20 @@ namespace Symfony\Component\Routing;
*/
class Route implements \Serializable
{
/**
* @var string
*/
private $path = '/';
/**
* @var string
*/
private $host = '';
/**
* @var array
*/
private $schemes = array();
/**
* @var array
*/
private $methods = array();
/**
* @var array
*/
private $defaults = array();
/**
* @var array
*/
private $requirements = array();
/**
* @var array
*/
private $options = array();
private $condition = '';
/**
* @var null|CompiledRoute
*/
private $compiled;
/**
* @var string
*/
private $condition = '';
/**
* Constructor.
*
@ -72,14 +41,14 @@ class Route implements \Serializable
* * compiler_class: A class name able to compile this route instance (RouteCompiler by default)
* * utf8: Whether UTF-8 matching is enforced ot not
*
* @param string $path The path pattern to match
* @param array $defaults An array of default parameter values
* @param array $requirements An array of requirements for parameters (regexes)
* @param array $options An array of options
* @param string $host The host pattern to match
* @param string|array $schemes A required URI scheme or an array of restricted schemes
* @param string|array $methods A required HTTP method or an array of restricted methods
* @param string $condition A condition that should evaluate to true for the route to match
* @param string $path The path pattern to match
* @param array $defaults An array of default parameter values
* @param array $requirements An array of requirements for parameters (regexes)
* @param array $options An array of options
* @param string $host The host pattern to match
* @param string|string[] $schemes A required URI scheme or an array of restricted schemes
* @param string|string[] $methods A required HTTP method or an array of restricted methods
* @param string $condition A condition that should evaluate to true for the route to match
*/
public function __construct($path, array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array(), $condition = '')
{
@ -116,11 +85,7 @@ class Route implements \Serializable
*/
public function unserialize($serialized)
{
if (\PHP_VERSION_ID >= 70000) {
$data = unserialize($serialized, array('allowed_classes' => array(CompiledRoute::class)));
} else {
$data = unserialize($serialized);
}
$data = unserialize($serialized);
$this->path = $data['path'];
$this->host = $data['host'];
$this->defaults = $data['defaults'];
@ -197,7 +162,7 @@ class Route implements \Serializable
* Returns the lowercased schemes this route is restricted to.
* So an empty array means that any scheme is allowed.
*
* @return array The schemes
* @return string[] The schemes
*/
public function getSchemes()
{
@ -210,7 +175,7 @@ class Route implements \Serializable
*
* This method implements a fluent interface.
*
* @param string|array $schemes The scheme or an array of schemes
* @param string|string[] $schemes The scheme or an array of schemes
*
* @return $this
*/
@ -231,14 +196,14 @@ class Route implements \Serializable
*/
public function hasScheme($scheme)
{
return in_array(strtolower($scheme), $this->schemes, true);
return \in_array(strtolower($scheme), $this->schemes, true);
}
/**
* Returns the uppercased HTTP methods this route is restricted to.
* So an empty array means that any method is allowed.
*
* @return array The methods
* @return string[] The methods
*/
public function getMethods()
{
@ -251,7 +216,7 @@ class Route implements \Serializable
*
* This method implements a fluent interface.
*
* @param string|array $methods The method or an array of methods
* @param string|string[] $methods The method or an array of methods
*
* @return $this
*/
@ -572,7 +537,7 @@ class Route implements \Serializable
private function sanitizeRequirement($key, $regex)
{
if (!is_string($regex)) {
if (!\is_string($regex)) {
throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string.', $key));
}

29
pfosten/vendor/symfony/routing/RouteCollection.php vendored Executable file → Normal file
View file

@ -63,7 +63,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
*/
public function count()
{
return count($this->routes);
return \count($this->routes);
}
/**
@ -104,7 +104,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
/**
* Removes a route or an array of routes by name from the collection.
*
* @param string|array $name The route name or an array of route names
* @param string|string[] $name The route name or an array of route names
*/
public function remove($name)
{
@ -116,10 +116,8 @@ class RouteCollection implements \IteratorAggregate, \Countable
/**
* Adds a route collection at the end of the current set by appending all
* routes of the added collection.
*
* @param RouteCollection $collection A RouteCollection instance
*/
public function addCollection(RouteCollection $collection)
public function addCollection(self $collection)
{
// we need to remove all routes with the same names first because just replacing them
// would not place the new route at the end of the merged array
@ -128,7 +126,9 @@ class RouteCollection implements \IteratorAggregate, \Countable
$this->routes[$name] = $route;
}
$this->resources = array_merge($this->resources, $collection->getResources());
foreach ($collection->getResources() as $resource) {
$this->addResource($resource);
}
}
/**
@ -234,7 +234,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
/**
* Sets the schemes (e.g. 'https') all child routes are restricted to.
*
* @param string|array $schemes The scheme or an array of schemes
* @param string|string[] $schemes The scheme or an array of schemes
*/
public function setSchemes($schemes)
{
@ -246,7 +246,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
/**
* Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
*
* @param string|array $methods The method or an array of methods
* @param string|string[] $methods The method or an array of methods
*/
public function setMethods($methods)
{
@ -262,16 +262,19 @@ class RouteCollection implements \IteratorAggregate, \Countable
*/
public function getResources()
{
return array_unique($this->resources);
return array_values($this->resources);
}
/**
* Adds a resource for this collection.
*
* @param ResourceInterface $resource A resource instance
* Adds a resource for this collection. If the resource already exists
* it is not added.
*/
public function addResource(ResourceInterface $resource)
{
$this->resources[] = $resource;
$key = (string) $resource;
if (!isset($this->resources[$key])) {
$this->resources[$key] = $resource;
}
}
}

23
pfosten/vendor/symfony/routing/RouteCollectionBuilder.php vendored Executable file → Normal file
View file

@ -38,9 +38,6 @@ class RouteCollectionBuilder
private $methods;
private $resources = array();
/**
* @param LoaderInterface $loader
*/
public function __construct(LoaderInterface $loader = null)
{
$this->loader = $loader;
@ -79,11 +76,11 @@ class RouteCollectionBuilder
foreach ($collection->getResources() as $resource) {
$builder->addResource($resource);
}
// mount into this builder
$this->mount($prefix, $builder);
}
// mount into this builder
$this->mount($prefix, $builder);
return $builder;
}
@ -121,7 +118,7 @@ class RouteCollectionBuilder
* @param string $prefix
* @param RouteCollectionBuilder $builder
*/
public function mount($prefix, RouteCollectionBuilder $builder)
public function mount($prefix, self $builder)
{
$builder->prefix = trim(trim($prefix), '/');
$this->routes[] = $builder;
@ -254,8 +251,6 @@ class RouteCollectionBuilder
/**
* Adds a resource for this collection.
*
* @param ResourceInterface $resource
*
* @return $this
*/
private function addResource(ResourceInterface $resource)
@ -318,10 +313,10 @@ class RouteCollectionBuilder
$routeCollection->addCollection($subCollection);
}
}
foreach ($this->resources as $resource) {
$routeCollection->addResource($resource);
}
foreach ($this->resources as $resource) {
$routeCollection->addResource($resource);
}
return $routeCollection;
@ -365,7 +360,7 @@ class RouteCollectionBuilder
if ($this->loader->supports($resource, $type)) {
$collections = $this->loader->load($resource, $type);
return is_array($collections) ? $collections : array($collections);
return \is_array($collections) ? $collections : array($collections);
}
if (null === $resolver = $this->loader->getResolver()) {
@ -378,6 +373,6 @@ class RouteCollectionBuilder
$collections = $loader->load($resource, $type);
return is_array($collections) ? $collections : array($collections);
return \is_array($collections) ? $collections : array($collections);
}
}

35
pfosten/vendor/symfony/routing/RouteCompiler.php vendored Executable file → Normal file
View file

@ -39,10 +39,10 @@ class RouteCompiler implements RouteCompilerInterface
/**
* {@inheritdoc}
*
* @throws \InvalidArgumentException If a path variable is named _fragment
* @throws \LogicException If a variable is referenced more than once
* @throws \DomainException If a variable name starts with a digit or if it is too long to be successfully used as
* a PCRE subpattern.
* @throws \InvalidArgumentException if a path variable is named _fragment
* @throws \LogicException if a variable is referenced more than once
* @throws \DomainException if a variable name starts with a digit or if it is too long to be successfully used as
* a PCRE subpattern
*/
public static function compile(Route $route)
{
@ -117,9 +117,9 @@ class RouteCompiler implements RouteCompilerInterface
$varName = substr($match[0][0], 1, -1);
// get all static text preceding the current variable
$precedingText = substr($pattern, $pos, $match[0][1] - $pos);
$pos = $match[0][1] + strlen($match[0][0]);
$pos = $match[0][1] + \strlen($match[0][0]);
if (!strlen($precedingText)) {
if (!\strlen($precedingText)) {
$precedingChar = '';
} elseif ($useUtf8) {
preg_match('/.$/u', $precedingText, $precedingChar);
@ -134,17 +134,17 @@ class RouteCompiler implements RouteCompilerInterface
if (preg_match('/^\d/', $varName)) {
throw new \DomainException(sprintf('Variable name "%s" cannot start with a digit in route pattern "%s". Please use a different name.', $varName, $pattern));
}
if (in_array($varName, $variables)) {
if (\in_array($varName, $variables)) {
throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $pattern, $varName));
}
if (strlen($varName) > self::VARIABLE_MAXIMUM_LENGTH) {
if (\strlen($varName) > self::VARIABLE_MAXIMUM_LENGTH) {
throw new \DomainException(sprintf('Variable name "%s" cannot be longer than %s characters in route pattern "%s". Please use a shorter name.', $varName, self::VARIABLE_MAXIMUM_LENGTH, $pattern));
}
if ($isSeparator && $precedingText !== $precedingChar) {
$tokens[] = array('text', substr($precedingText, 0, -strlen($precedingChar)));
} elseif (!$isSeparator && strlen($precedingText) > 0) {
$tokens[] = array('text', substr($precedingText, 0, -\strlen($precedingChar)));
} elseif (!$isSeparator && \strlen($precedingText) > 0) {
$tokens[] = array('text', $precedingText);
}
@ -188,14 +188,14 @@ class RouteCompiler implements RouteCompilerInterface
$variables[] = $varName;
}
if ($pos < strlen($pattern)) {
if ($pos < \strlen($pattern)) {
$tokens[] = array('text', substr($pattern, $pos));
}
// find the first optional token
$firstOptional = PHP_INT_MAX;
if (!$isHost) {
for ($i = count($tokens) - 1; $i >= 0; --$i) {
for ($i = \count($tokens) - 1; $i >= 0; --$i) {
$token = $tokens[$i];
if ('variable' === $token[0] && $route->hasDefault($token[3])) {
$firstOptional = $i;
@ -207,15 +207,15 @@ class RouteCompiler implements RouteCompilerInterface
// compute the matching regexp
$regexp = '';
for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) {
for ($i = 0, $nbToken = \count($tokens); $i < $nbToken; ++$i) {
$regexp .= self::computeRegexp($tokens, $i, $firstOptional);
}
$regexp = self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'s'.($isHost ? 'i' : '');
$regexp = self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'sD'.($isHost ? 'i' : '');
// enable Utf8 matching if really required
if ($needsUtf8) {
$regexp .= 'u';
for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) {
for ($i = 0, $nbToken = \count($tokens); $i < $nbToken; ++$i) {
if ('variable' === $tokens[$i][0]) {
$tokens[$i][] = true;
}
@ -233,9 +233,6 @@ class RouteCompiler implements RouteCompilerInterface
/**
* Determines the longest static prefix possible for a route.
*
* @param Route $route
* @param array $tokens
*
* @return string The leading static part of a route's path
*/
private static function determineStaticPrefix(Route $route, array $tokens)
@ -305,7 +302,7 @@ class RouteCompiler implements RouteCompilerInterface
// "?:" means it is non-capturing, i.e. the portion of the subject string that
// matched the optional subpattern is not passed back.
$regexp = "(?:$regexp";
$nbTokens = count($tokens);
$nbTokens = \count($tokens);
if ($nbTokens - 1 == $index) {
// Close the optional subpatterns
$regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0));

2
pfosten/vendor/symfony/routing/RouteCompilerInterface.php vendored Executable file → Normal file
View file

@ -21,8 +21,6 @@ interface RouteCompilerInterface
/**
* Compiles the current route instance.
*
* @param Route $route A Route instance
*
* @return CompiledRoute A CompiledRoute instance
*
* @throws \LogicException If the Route cannot be compiled because the

28
pfosten/vendor/symfony/routing/Router.php vendored Executable file → Normal file
View file

@ -11,19 +11,19 @@
namespace Symfony\Component\Routing;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\ConfigCacheInterface;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\Config\ConfigCacheFactory;
use Psr\Log\LoggerInterface;
use Symfony\Component\Config\ConfigCacheFactory;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\Config\ConfigCacheInterface;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Generator\ConfigurableRequirementsInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface;
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
/**
* The Router class is an example of the integration of all pieces of the
@ -84,8 +84,6 @@ class Router implements RouterInterface, RequestMatcherInterface
private $expressionLanguageProviders = array();
/**
* Constructor.
*
* @param LoaderInterface $loader A LoaderInterface instance
* @param mixed $resource The main resource to load
* @param array $options An array of options
@ -228,8 +226,6 @@ class Router implements RouterInterface, RequestMatcherInterface
/**
* Sets the ConfigCache factory to use.
*
* @param ConfigCacheFactoryInterface $configCacheFactory The factory to use
*/
public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory)
{
@ -306,7 +302,9 @@ class Router implements RouterInterface, RequestMatcherInterface
}
);
require_once $cache->getPath();
if (!class_exists($this->options['matcher_cache_class'], false)) {
require_once $cache->getPath();
}
return $this->matcher = new $this->options['matcher_cache_class']($this->context);
}
@ -338,7 +336,9 @@ class Router implements RouterInterface, RequestMatcherInterface
}
);
require_once $cache->getPath();
if (!class_exists($this->options['generator_cache_class'], false)) {
require_once $cache->getPath();
}
$this->generator = new $this->options['generator_cache_class']($this->context, $this->logger);
}

0
pfosten/vendor/symfony/routing/RouterInterface.php vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Annotation/RouteTest.php vendored Executable file → Normal file
View file

2
pfosten/vendor/symfony/routing/Tests/CompiledRouteTest.php vendored Executable file → Normal file
View file

@ -18,7 +18,7 @@ class CompiledRouteTest extends TestCase
{
public function testAccessors()
{
$compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array(), array(), array(), array(), array('variables'));
$compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array(), null, array(), array(), array('variables'));
$this->assertEquals('prefix', $compiled->getStaticPrefix(), '__construct() takes a static prefix as its second argument');
$this->assertEquals('regex', $compiled->getRegex(), '__construct() takes a regexp as its third argument');
$this->assertEquals(array('tokens'), $compiled->getTokens(), '__construct() takes an array of tokens as its fourth argument');

View file

View file

View file

View file

View file

View file

View file

@ -11,8 +11,8 @@
namespace Symfony\Component\Routing\Tests\Fixtures;
use Symfony\Component\Routing\Loader\XmlFileLoader;
use Symfony\Component\Config\Util\XmlUtils;
use Symfony\Component\Routing\Loader\XmlFileLoader;
/**
* XmlFileLoader with schema validation turned off.

View file

@ -11,8 +11,8 @@
namespace Symfony\Component\Routing\Tests\Fixtures;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
use Symfony\Component\Routing\Matcher\UrlMatcher;
/**
* @author Fabien Potencier <fabien@symfony.com>

0
pfosten/vendor/symfony/routing/Tests/Fixtures/annotated.php vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/bad_format.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/bar.xml vendored Executable file → Normal file
View file

View file

View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml vendored Executable file → Normal file
View file

View file

View file

@ -1,163 +0,0 @@
# skip "real" requests
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [QSA,L]
# foo
RewriteCond %{REQUEST_URI} ^/foo/(baz|symfony)$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:foo,E=_ROUTING_param_bar:%1,E=_ROUTING_default_def:test]
# foobar
RewriteCond %{REQUEST_URI} ^/foo(?:/([^/]++))?$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:foobar,E=_ROUTING_param_bar:%1,E=_ROUTING_default_bar:toto]
# bar
RewriteCond %{REQUEST_URI} ^/bar/([^/]++)$
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [NC]
RewriteRule .* - [S=1,E=_ROUTING_allow_GET:1,E=_ROUTING_allow_HEAD:1]
RewriteCond %{REQUEST_URI} ^/bar/([^/]++)$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:bar,E=_ROUTING_param_foo:%1]
# baragain
RewriteCond %{REQUEST_URI} ^/baragain/([^/]++)$
RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD)$ [NC]
RewriteRule .* - [S=1,E=_ROUTING_allow_GET:1,E=_ROUTING_allow_POST:1,E=_ROUTING_allow_HEAD:1]
RewriteCond %{REQUEST_URI} ^/baragain/([^/]++)$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baragain,E=_ROUTING_param_foo:%1]
# baz
RewriteCond %{REQUEST_URI} ^/test/baz$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz]
# baz2
RewriteCond %{REQUEST_URI} ^/test/baz\.html$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz2]
# baz3
RewriteCond %{REQUEST_URI} ^/test/baz3$
RewriteRule .* $0/ [QSA,L,R=301]
RewriteCond %{REQUEST_URI} ^/test/baz3/$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz3]
# baz4
RewriteCond %{REQUEST_URI} ^/test/([^/]++)$
RewriteRule .* $0/ [QSA,L,R=301]
RewriteCond %{REQUEST_URI} ^/test/([^/]++)/$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz4,E=_ROUTING_param_foo:%1]
# baz5
RewriteCond %{REQUEST_URI} ^/test/([^/]++)/$
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [NC]
RewriteRule .* - [S=2,E=_ROUTING_allow_GET:1,E=_ROUTING_allow_HEAD:1]
RewriteCond %{REQUEST_URI} ^/test/([^/]++)$
RewriteRule .* $0/ [QSA,L,R=301]
RewriteCond %{REQUEST_URI} ^/test/([^/]++)/$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz5,E=_ROUTING_param_foo:%1]
# baz5unsafe
RewriteCond %{REQUEST_URI} ^/testunsafe/([^/]++)/$
RewriteCond %{REQUEST_METHOD} !^(POST)$ [NC]
RewriteRule .* - [S=1,E=_ROUTING_allow_POST:1]
RewriteCond %{REQUEST_URI} ^/testunsafe/([^/]++)/$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz5unsafe,E=_ROUTING_param_foo:%1]
# baz6
RewriteCond %{REQUEST_URI} ^/test/baz$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz6,E=_ROUTING_default_foo:bar\ baz]
# baz7
RewriteCond %{REQUEST_URI} ^/te\ st/baz$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz7]
# baz8
RewriteCond %{REQUEST_URI} ^/te\\\ st/baz$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz8]
# baz9
RewriteCond %{REQUEST_URI} ^/test/(te\\\ st)$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:baz9,E=_ROUTING_param_baz:%1]
RewriteCond %{HTTP:Host} ^a\.example\.com$
RewriteRule .? - [E=__ROUTING_host_1:1]
# route1
RewriteCond %{ENV:__ROUTING_host_1} =1
RewriteCond %{REQUEST_URI} ^/route1$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route1]
# route2
RewriteCond %{ENV:__ROUTING_host_1} =1
RewriteCond %{REQUEST_URI} ^/c2/route2$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route2]
RewriteCond %{HTTP:Host} ^b\.example\.com$
RewriteRule .? - [E=__ROUTING_host_2:1]
# route3
RewriteCond %{ENV:__ROUTING_host_2} =1
RewriteCond %{REQUEST_URI} ^/c2/route3$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route3]
RewriteCond %{HTTP:Host} ^a\.example\.com$
RewriteRule .? - [E=__ROUTING_host_3:1]
# route4
RewriteCond %{ENV:__ROUTING_host_3} =1
RewriteCond %{REQUEST_URI} ^/route4$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route4]
RewriteCond %{HTTP:Host} ^c\.example\.com$
RewriteRule .? - [E=__ROUTING_host_4:1]
# route5
RewriteCond %{ENV:__ROUTING_host_4} =1
RewriteCond %{REQUEST_URI} ^/route5$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route5]
# route6
RewriteCond %{REQUEST_URI} ^/route6$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route6]
RewriteCond %{HTTP:Host} ^([^\.]++)\.example\.com$
RewriteRule .? - [E=__ROUTING_host_5:1,E=__ROUTING_host_5_var1:%1]
# route11
RewriteCond %{ENV:__ROUTING_host_5} =1
RewriteCond %{REQUEST_URI} ^/route11$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route11,E=_ROUTING_param_var1:%{ENV:__ROUTING_host_5_var1}]
# route12
RewriteCond %{ENV:__ROUTING_host_5} =1
RewriteCond %{REQUEST_URI} ^/route12$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route12,E=_ROUTING_param_var1:%{ENV:__ROUTING_host_5_var1},E=_ROUTING_default_var1:val]
# route13
RewriteCond %{ENV:__ROUTING_host_5} =1
RewriteCond %{REQUEST_URI} ^/route13/([^/]++)$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route13,E=_ROUTING_param_var1:%{ENV:__ROUTING_host_5_var1},E=_ROUTING_param_name:%1]
# route14
RewriteCond %{ENV:__ROUTING_host_5} =1
RewriteCond %{REQUEST_URI} ^/route14/([^/]++)$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route14,E=_ROUTING_param_var1:%{ENV:__ROUTING_host_5_var1},E=_ROUTING_param_name:%1,E=_ROUTING_default_var1:val]
RewriteCond %{HTTP:Host} ^c\.example\.com$
RewriteRule .? - [E=__ROUTING_host_6:1]
# route15
RewriteCond %{ENV:__ROUTING_host_6} =1
RewriteCond %{REQUEST_URI} ^/route15/([^/]++)$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route15,E=_ROUTING_param_name:%1]
# route16
RewriteCond %{REQUEST_URI} ^/route16/([^/]++)$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route16,E=_ROUTING_param_name:%1,E=_ROUTING_default_var1:val]
# route17
RewriteCond %{REQUEST_URI} ^/route17$
RewriteRule .* app.php [QSA,L,E=_ROUTING_route:route17]
# 405 Method Not Allowed
RewriteCond %{ENV:_ROUTING__allow_GET} =1 [OR]
RewriteCond %{ENV:_ROUTING__allow_HEAD} =1 [OR]
RewriteCond %{ENV:_ROUTING__allow_POST} =1
RewriteRule .* app.php [QSA,L]

101
pfosten/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php vendored Executable file → Normal file
View file

@ -5,39 +5,32 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* ProjectUrlMatcher.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
{
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function match($pathinfo)
public function match($rawPathinfo)
{
$allow = array();
$pathinfo = rawurldecode($pathinfo);
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
if (0 === strpos($pathinfo, '/foo')) {
// foo
if (preg_match('#^/foo/(?P<bar>baz|symfony)$#s', $pathinfo, $matches)) {
if (preg_match('#^/foo/(?P<bar>baz|symfony)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
}
@ -50,24 +43,26 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
elseif (0 === strpos($pathinfo, '/bar')) {
// bar
if (preg_match('#^/bar/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
if (preg_match('#^/bar/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
if (!in_array($canonicalMethod, array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_bar;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
return $ret;
}
not_bar:
// barhead
if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_barhead;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
return $ret;
}
not_barhead:
@ -93,36 +88,38 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// baz4
if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
}
// baz5
if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_baz5;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
return $ret;
}
not_baz5:
// baz.baz6
if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
if ('PUT' !== $canonicalMethod) {
$allow[] = 'PUT';
if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
if (!in_array($requestMethod, array('PUT'))) {
$allow = array_merge($allow, array('PUT'));
goto not_bazbaz6;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
return $ret;
}
not_bazbaz6:
}
// quoter
if (preg_match('#^/(?P<quoter>[\']+)$#s', $pathinfo, $matches)) {
if (preg_match('#^/(?P<quoter>[\']+)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
}
@ -134,30 +131,30 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
if (0 === strpos($pathinfo, '/a')) {
if (0 === strpos($pathinfo, '/a/b\'b')) {
// foo1
if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
}
// bar1
if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
}
}
// overridden
if (preg_match('#^/a/(?P<var>.*)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/(?P<var>.*)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
}
if (0 === strpos($pathinfo, '/a/b\'b')) {
// foo2
if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
}
// bar2
if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
}
@ -167,7 +164,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
elseif (0 === strpos($pathinfo, '/multi')) {
// helloWorld
if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
}
@ -184,12 +181,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// foo3
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
}
// bar3
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
}
@ -200,7 +197,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// foo4
if (preg_match('#^/aba/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/aba/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
}
@ -208,7 +205,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$host = $context->getHost();
if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
// route1
if ('/route1' === $pathinfo) {
return array('_route' => 'route1');
@ -221,7 +218,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) {
// route3
if ('/c2/route3' === $pathinfo) {
return array('_route' => 'route3');
@ -229,7 +226,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
// route4
if ('/route4' === $pathinfo) {
return array('_route' => 'route4');
@ -237,7 +234,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
// route5
if ('/route5' === $pathinfo) {
return array('_route' => 'route5');
@ -250,7 +247,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
return array('_route' => 'route6');
}
if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) {
if (0 === strpos($pathinfo, '/route1')) {
// route11
if ('/route11' === $pathinfo) {
@ -263,12 +260,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// route13
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
}
// route14
if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
}
@ -276,16 +273,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
// route15
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
}
}
// route16
if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
}
@ -301,17 +298,21 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
if (0 === strpos($pathinfo, '/a/b')) {
// b
if (preg_match('#^/a/b/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
}
// c
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
}
}
if ('/' === $pathinfo && !$allow) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}

View file

@ -1,7 +0,0 @@
# skip "real" requests
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [QSA,L]
# foo
RewriteCond %{REQUEST_URI} ^/foo$
RewriteRule .* ap\ p_d\ ev.php [QSA,L,E=_ROUTING_route:foo]

161
pfosten/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php vendored Executable file → Normal file
View file

@ -5,39 +5,32 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* ProjectUrlMatcher.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher
{
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function match($pathinfo)
public function match($rawPathinfo)
{
$allow = array();
$pathinfo = rawurldecode($pathinfo);
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
if (0 === strpos($pathinfo, '/foo')) {
// foo
if (preg_match('#^/foo/(?P<bar>baz|symfony)$#s', $pathinfo, $matches)) {
if (preg_match('#^/foo/(?P<bar>baz|symfony)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
}
@ -50,24 +43,26 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
elseif (0 === strpos($pathinfo, '/bar')) {
// bar
if (preg_match('#^/bar/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
if (preg_match('#^/bar/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
if (!in_array($canonicalMethod, array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_bar;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
return $ret;
}
not_bar:
// barhead
if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_barhead;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
return $ret;
}
not_barhead:
@ -87,50 +82,64 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// baz3
if ('/test/baz3' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'baz3');
$ret = array('_route' => 'baz3');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_baz3;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz3'));
}
return array('_route' => 'baz3');
return $ret;
}
not_baz3:
}
// baz4
if (preg_match('#^/test/(?P<foo>[^/]++)/?$#s', $pathinfo, $matches)) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'baz4');
if (preg_match('#^/test/(?P<foo>[^/]++)/?$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_baz4;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz4'));
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
return $ret;
}
not_baz4:
// baz5
if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_baz5;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
return $ret;
}
not_baz5:
// baz.baz6
if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
if ('PUT' !== $canonicalMethod) {
$allow[] = 'PUT';
if (preg_match('#^/test/(?P<foo>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
if (!in_array($requestMethod, array('PUT'))) {
$allow = array_merge($allow, array('PUT'));
goto not_bazbaz6;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
return $ret;
}
not_bazbaz6:
}
// quoter
if (preg_match('#^/(?P<quoter>[\']+)$#s', $pathinfo, $matches)) {
if (preg_match('#^/(?P<quoter>[\']+)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
}
@ -142,30 +151,30 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (0 === strpos($pathinfo, '/a')) {
if (0 === strpos($pathinfo, '/a/b\'b')) {
// foo1
if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
}
// bar1
if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
}
}
// overridden
if (preg_match('#^/a/(?P<var>.*)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/(?P<var>.*)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
}
if (0 === strpos($pathinfo, '/a/b\'b')) {
// foo2
if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b\'b/(?P<foo1>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
}
// bar2
if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
}
@ -175,18 +184,24 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
elseif (0 === strpos($pathinfo, '/multi')) {
// helloWorld
if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
}
// hey
if ('/multi/hey' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'hey');
$ret = array('_route' => 'hey');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_hey;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'hey'));
}
return array('_route' => 'hey');
return $ret;
}
not_hey:
// overridden2
if ('/multi/new' === $pathinfo) {
@ -196,12 +211,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
// foo3
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
}
// bar3
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
}
@ -212,7 +227,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
// foo4
if (preg_match('#^/aba/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/aba/(?P<foo>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
}
@ -220,7 +235,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$host = $context->getHost();
if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
// route1
if ('/route1' === $pathinfo) {
return array('_route' => 'route1');
@ -233,7 +248,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) {
// route3
if ('/c2/route3' === $pathinfo) {
return array('_route' => 'route3');
@ -241,7 +256,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
// route4
if ('/route4' === $pathinfo) {
return array('_route' => 'route4');
@ -249,7 +264,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
// route5
if ('/route5' === $pathinfo) {
return array('_route' => 'route5');
@ -262,7 +277,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
return array('_route' => 'route6');
}
if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) {
if (0 === strpos($pathinfo, '/route1')) {
// route11
if ('/route11' === $pathinfo) {
@ -275,12 +290,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
// route13
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
}
// route14
if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
}
@ -288,16 +303,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
// route15
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
}
}
// route16
if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P<name>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
}
@ -313,12 +328,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (0 === strpos($pathinfo, '/a/b')) {
// b
if (preg_match('#^/a/b/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/a/b/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
}
// c
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
}
@ -326,22 +341,38 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// secure
if ('/secure' === $pathinfo) {
$ret = array('_route' => 'secure');
$requiredSchemes = array ( 'https' => 0,);
if (!isset($requiredSchemes[$scheme])) {
return $this->redirect($pathinfo, 'secure', key($requiredSchemes));
if (!isset($requiredSchemes[$context->getScheme()])) {
if ('GET' !== $canonicalMethod) {
goto not_secure;
}
return array_replace($ret, $this->redirect($rawPathinfo, 'secure', key($requiredSchemes)));
}
return array('_route' => 'secure');
return $ret;
}
not_secure:
// nonsecure
if ('/nonsecure' === $pathinfo) {
$ret = array('_route' => 'nonsecure');
$requiredSchemes = array ( 'http' => 0,);
if (!isset($requiredSchemes[$scheme])) {
return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes));
if (!isset($requiredSchemes[$context->getScheme()])) {
if ('GET' !== $canonicalMethod) {
goto not_nonsecure;
}
return array_replace($ret, $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes)));
}
return array('_route' => 'nonsecure');
return $ret;
}
not_nonsecure:
if ('/' === $pathinfo && !$allow) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();

19
pfosten/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php vendored Executable file → Normal file
View file

@ -5,36 +5,29 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* ProjectUrlMatcher.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
{
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function match($pathinfo)
public function match($rawPathinfo)
{
$allow = array();
$pathinfo = rawurldecode($pathinfo);
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
if (0 === strpos($pathinfo, '/rootprefix')) {
// static
if ('/rootprefix/test' === $pathinfo) {
@ -42,7 +35,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// dynamic
if (preg_match('#^/rootprefix/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/rootprefix/(?P<var>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ());
}
@ -53,6 +46,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
return array('_route' => 'with-condition');
}
if ('/' === $pathinfo && !$allow) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}

58
pfosten/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php vendored Executable file → Normal file
View file

@ -5,94 +5,108 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* ProjectUrlMatcher.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
{
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function match($pathinfo)
public function match($rawPathinfo)
{
$allow = array();
$pathinfo = rawurldecode($pathinfo);
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
// just_head
if ('/just_head' === $pathinfo) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
$ret = array('_route' => 'just_head');
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_just_head;
}
return array('_route' => 'just_head');
return $ret;
}
not_just_head:
// head_and_get
if ('/head_and_get' === $pathinfo) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
$ret = array('_route' => 'head_and_get');
if (!in_array($canonicalMethod, array('HEAD', 'GET'))) {
$allow = array_merge($allow, array('HEAD', 'GET'));
goto not_head_and_get;
}
return array('_route' => 'head_and_get');
return $ret;
}
not_head_and_get:
// get_and_head
if ('/get_and_head' === $pathinfo) {
$ret = array('_route' => 'get_and_head');
if (!in_array($canonicalMethod, array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_get_and_head;
}
return $ret;
}
not_get_and_head:
// post_and_head
if ('/post_and_get' === $pathinfo) {
if ('/post_and_head' === $pathinfo) {
$ret = array('_route' => 'post_and_head');
if (!in_array($requestMethod, array('POST', 'HEAD'))) {
$allow = array_merge($allow, array('POST', 'HEAD'));
goto not_post_and_head;
}
return array('_route' => 'post_and_head');
return $ret;
}
not_post_and_head:
if (0 === strpos($pathinfo, '/put_and_post')) {
// put_and_post
if ('/put_and_post' === $pathinfo) {
$ret = array('_route' => 'put_and_post');
if (!in_array($requestMethod, array('PUT', 'POST'))) {
$allow = array_merge($allow, array('PUT', 'POST'));
goto not_put_and_post;
}
return array('_route' => 'put_and_post');
return $ret;
}
not_put_and_post:
// put_and_get_and_head
if ('/put_and_post' === $pathinfo) {
if (!in_array($canonicalMethod, array('PUT', 'GET'))) {
$allow = array_merge($allow, array('PUT', 'GET'));
$ret = array('_route' => 'put_and_get_and_head');
if (!in_array($canonicalMethod, array('PUT', 'GET', 'HEAD'))) {
$allow = array_merge($allow, array('PUT', 'GET', 'HEAD'));
goto not_put_and_get_and_head;
}
return array('_route' => 'put_and_get_and_head');
return $ret;
}
not_put_and_get_and_head:
}
if ('/' === $pathinfo && !$allow) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}

129
pfosten/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php vendored Executable file → Normal file
View file

@ -5,36 +5,29 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* ProjectUrlMatcher.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher
{
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function match($pathinfo)
public function match($rawPathinfo)
{
$allow = array();
$pathinfo = rawurldecode($pathinfo);
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
if (0 === strpos($pathinfo, '/a')) {
// a_first
if ('/a/11' === $pathinfo) {
@ -54,105 +47,163 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
// a_wildcard
if (preg_match('#^/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if (preg_match('#^/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'a_wildcard')), array ());
}
if (0 === strpos($pathinfo, '/a')) {
// a_fourth
if ('/a/44' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'a_fourth');
$ret = array('_route' => 'a_fourth');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_a_fourth;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fourth'));
}
return array('_route' => 'a_fourth');
return $ret;
}
not_a_fourth:
// a_fifth
if ('/a/55' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'a_fifth');
$ret = array('_route' => 'a_fifth');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_a_fifth;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fifth'));
}
return array('_route' => 'a_fifth');
return $ret;
}
not_a_fifth:
// a_sixth
if ('/a/66' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'a_sixth');
$ret = array('_route' => 'a_sixth');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_a_sixth;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_sixth'));
}
return array('_route' => 'a_sixth');
return $ret;
}
not_a_sixth:
}
// nested_wildcard
if (0 === strpos($pathinfo, '/nested') && preg_match('#^/nested/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/nested') && preg_match('#^/nested/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'nested_wildcard')), array ());
}
if (0 === strpos($pathinfo, '/nested/group')) {
// nested_a
if ('/nested/group/a' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'nested_a');
$ret = array('_route' => 'nested_a');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_nested_a;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_a'));
}
return array('_route' => 'nested_a');
return $ret;
}
not_nested_a:
// nested_b
if ('/nested/group/b' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'nested_b');
$ret = array('_route' => 'nested_b');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_nested_b;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_b'));
}
return array('_route' => 'nested_b');
return $ret;
}
not_nested_b:
// nested_c
if ('/nested/group/c' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'nested_c');
$ret = array('_route' => 'nested_c');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_nested_c;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_c'));
}
return array('_route' => 'nested_c');
return $ret;
}
not_nested_c:
}
elseif (0 === strpos($pathinfo, '/slashed/group')) {
// slashed_a
if ('/slashed/group' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'slashed_a');
$ret = array('_route' => 'slashed_a');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_slashed_a;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_a'));
}
return array('_route' => 'slashed_a');
return $ret;
}
not_slashed_a:
// slashed_b
if ('/slashed/group/b' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'slashed_b');
$ret = array('_route' => 'slashed_b');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_slashed_b;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_b'));
}
return array('_route' => 'slashed_b');
return $ret;
}
not_slashed_b:
// slashed_c
if ('/slashed/group/c' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'slashed_c');
$ret = array('_route' => 'slashed_c');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_slashed_c;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_c'));
}
return array('_route' => 'slashed_c');
return $ret;
}
not_slashed_c:
}
if ('/' === $pathinfo && !$allow) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}

117
pfosten/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php vendored Executable file → Normal file
View file

@ -5,36 +5,29 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* ProjectUrlMatcher.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
{
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function match($pathinfo)
public function match($rawPathinfo)
{
$allow = array();
$pathinfo = rawurldecode($pathinfo);
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
if (0 === strpos($pathinfo, '/trailing/simple')) {
// simple_trailing_slash_no_methods
if ('/trailing/simple/no-methods/' === $pathinfo) {
@ -43,34 +36,37 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// simple_trailing_slash_GET_method
if ('/trailing/simple/get-method/' === $pathinfo) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
$ret = array('_route' => 'simple_trailing_slash_GET_method');
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_simple_trailing_slash_GET_method;
}
return array('_route' => 'simple_trailing_slash_GET_method');
return $ret;
}
not_simple_trailing_slash_GET_method:
// simple_trailing_slash_HEAD_method
if ('/trailing/simple/head-method/' === $pathinfo) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
$ret = array('_route' => 'simple_trailing_slash_HEAD_method');
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_simple_trailing_slash_HEAD_method;
}
return array('_route' => 'simple_trailing_slash_HEAD_method');
return $ret;
}
not_simple_trailing_slash_HEAD_method:
// simple_trailing_slash_POST_method
if ('/trailing/simple/post-method/' === $pathinfo) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
$ret = array('_route' => 'simple_trailing_slash_POST_method');
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_simple_trailing_slash_POST_method;
}
return array('_route' => 'simple_trailing_slash_POST_method');
return $ret;
}
not_simple_trailing_slash_POST_method:
@ -78,40 +74,43 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
elseif (0 === strpos($pathinfo, '/trailing/regex')) {
// regex_trailing_slash_no_methods
if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
}
// regex_trailing_slash_GET_method
if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_regex_trailing_slash_GET_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
return $ret;
}
not_regex_trailing_slash_GET_method:
// regex_trailing_slash_HEAD_method
if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_regex_trailing_slash_HEAD_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
return $ret;
}
not_regex_trailing_slash_HEAD_method:
// regex_trailing_slash_POST_method
if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_regex_trailing_slash_POST_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
return $ret;
}
not_regex_trailing_slash_POST_method:
@ -125,34 +124,37 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// simple_not_trailing_slash_GET_method
if ('/not-trailing/simple/get-method' === $pathinfo) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
$ret = array('_route' => 'simple_not_trailing_slash_GET_method');
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_simple_not_trailing_slash_GET_method;
}
return array('_route' => 'simple_not_trailing_slash_GET_method');
return $ret;
}
not_simple_not_trailing_slash_GET_method:
// simple_not_trailing_slash_HEAD_method
if ('/not-trailing/simple/head-method' === $pathinfo) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
$ret = array('_route' => 'simple_not_trailing_slash_HEAD_method');
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_simple_not_trailing_slash_HEAD_method;
}
return array('_route' => 'simple_not_trailing_slash_HEAD_method');
return $ret;
}
not_simple_not_trailing_slash_HEAD_method:
// simple_not_trailing_slash_POST_method
if ('/not-trailing/simple/post-method' === $pathinfo) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
$ret = array('_route' => 'simple_not_trailing_slash_POST_method');
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_simple_not_trailing_slash_POST_method;
}
return array('_route' => 'simple_not_trailing_slash_POST_method');
return $ret;
}
not_simple_not_trailing_slash_POST_method:
@ -160,45 +162,52 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
elseif (0 === strpos($pathinfo, '/not-trailing/regex')) {
// regex_not_trailing_slash_no_methods
if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ());
}
// regex_not_trailing_slash_GET_method
if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_regex_not_trailing_slash_GET_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
return $ret;
}
not_regex_not_trailing_slash_GET_method:
// regex_not_trailing_slash_HEAD_method
if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_regex_not_trailing_slash_HEAD_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
return $ret;
}
not_regex_not_trailing_slash_HEAD_method:
// regex_not_trailing_slash_POST_method
if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_regex_not_trailing_slash_POST_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
return $ret;
}
not_regex_not_trailing_slash_POST_method:
}
if ('/' === $pathinfo && !$allow) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}

175
pfosten/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php vendored Executable file → Normal file
View file

@ -5,84 +5,86 @@ use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;
/**
* ProjectUrlMatcher.
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher
{
/**
* Constructor.
*/
public function __construct(RequestContext $context)
{
$this->context = $context;
}
public function match($pathinfo)
public function match($rawPathinfo)
{
$allow = array();
$pathinfo = rawurldecode($pathinfo);
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
$request = $this->request;
$request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
$scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
if (0 === strpos($pathinfo, '/trailing/simple')) {
// simple_trailing_slash_no_methods
if ('/trailing/simple/no-methods' === $trimmedPathinfo) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'simple_trailing_slash_no_methods');
$ret = array('_route' => 'simple_trailing_slash_no_methods');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_simple_trailing_slash_no_methods;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_no_methods'));
}
return array('_route' => 'simple_trailing_slash_no_methods');
return $ret;
}
not_simple_trailing_slash_no_methods:
// simple_trailing_slash_GET_method
if ('/trailing/simple/get-method' === $trimmedPathinfo) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
$ret = array('_route' => 'simple_trailing_slash_GET_method');
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_simple_trailing_slash_GET_method;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method'));
}
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_simple_trailing_slash_GET_method;
}
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'simple_trailing_slash_GET_method');
}
return array('_route' => 'simple_trailing_slash_GET_method');
return $ret;
}
not_simple_trailing_slash_GET_method:
// simple_trailing_slash_HEAD_method
if ('/trailing/simple/head-method' === $trimmedPathinfo) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
if ('/trailing/simple/head-method/' === $pathinfo) {
$ret = array('_route' => 'simple_trailing_slash_HEAD_method');
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_simple_trailing_slash_HEAD_method;
}
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'simple_trailing_slash_HEAD_method');
}
return array('_route' => 'simple_trailing_slash_HEAD_method');
return $ret;
}
not_simple_trailing_slash_HEAD_method:
// simple_trailing_slash_POST_method
if ('/trailing/simple/post-method/' === $pathinfo) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
$ret = array('_route' => 'simple_trailing_slash_POST_method');
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_simple_trailing_slash_POST_method;
}
return array('_route' => 'simple_trailing_slash_POST_method');
return $ret;
}
not_simple_trailing_slash_POST_method:
@ -90,52 +92,61 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
elseif (0 === strpos($pathinfo, '/trailing/regex')) {
// regex_trailing_slash_no_methods
if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/?$#s', $pathinfo, $matches)) {
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'regex_trailing_slash_no_methods');
if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P<param>[^/]++)/?$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_regex_trailing_slash_no_methods;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_no_methods'));
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
return $ret;
}
not_regex_trailing_slash_no_methods:
// regex_trailing_slash_GET_method
if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P<param>[^/]++)/?$#s', $pathinfo, $matches)) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P<param>[^/]++)/?$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
if ('/' === substr($pathinfo, -1)) {
// no-op
} elseif ('GET' !== $canonicalMethod) {
goto not_regex_trailing_slash_GET_method;
} else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method'));
}
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_regex_trailing_slash_GET_method;
}
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'regex_trailing_slash_GET_method');
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
return $ret;
}
not_regex_trailing_slash_GET_method:
// regex_trailing_slash_HEAD_method
if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P<param>[^/]++)/?$#s', $pathinfo, $matches)) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_regex_trailing_slash_HEAD_method;
}
if (substr($pathinfo, -1) !== '/') {
return $this->redirect($pathinfo.'/', 'regex_trailing_slash_HEAD_method');
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
return $ret;
}
not_regex_trailing_slash_HEAD_method:
// regex_trailing_slash_POST_method
if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P<param>[^/]++)/$#s', $pathinfo, $matches)) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P<param>[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_regex_trailing_slash_POST_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
return $ret;
}
not_regex_trailing_slash_POST_method:
@ -149,34 +160,37 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// simple_not_trailing_slash_GET_method
if ('/not-trailing/simple/get-method' === $pathinfo) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
$ret = array('_route' => 'simple_not_trailing_slash_GET_method');
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_simple_not_trailing_slash_GET_method;
}
return array('_route' => 'simple_not_trailing_slash_GET_method');
return $ret;
}
not_simple_not_trailing_slash_GET_method:
// simple_not_trailing_slash_HEAD_method
if ('/not-trailing/simple/head-method' === $pathinfo) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
$ret = array('_route' => 'simple_not_trailing_slash_HEAD_method');
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_simple_not_trailing_slash_HEAD_method;
}
return array('_route' => 'simple_not_trailing_slash_HEAD_method');
return $ret;
}
not_simple_not_trailing_slash_HEAD_method:
// simple_not_trailing_slash_POST_method
if ('/not-trailing/simple/post-method' === $pathinfo) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
$ret = array('_route' => 'simple_not_trailing_slash_POST_method');
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_simple_not_trailing_slash_POST_method;
}
return array('_route' => 'simple_not_trailing_slash_POST_method');
return $ret;
}
not_simple_not_trailing_slash_POST_method:
@ -184,45 +198,52 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
elseif (0 === strpos($pathinfo, '/not-trailing/regex')) {
// regex_not_trailing_slash_no_methods
if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ());
}
// regex_not_trailing_slash_GET_method
if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if ('GET' !== $canonicalMethod) {
$allow[] = 'GET';
if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
if (!in_array($canonicalMethod, array('GET'))) {
$allow = array_merge($allow, array('GET'));
goto not_regex_not_trailing_slash_GET_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
return $ret;
}
not_regex_not_trailing_slash_GET_method:
// regex_not_trailing_slash_HEAD_method
if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if ('HEAD' !== $requestMethod) {
$allow[] = 'HEAD';
if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
if (!in_array($requestMethod, array('HEAD'))) {
$allow = array_merge($allow, array('HEAD'));
goto not_regex_not_trailing_slash_HEAD_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
return $ret;
}
not_regex_not_trailing_slash_HEAD_method:
// regex_not_trailing_slash_POST_method
if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P<param>[^/]++)$#s', $pathinfo, $matches)) {
if ('POST' !== $canonicalMethod) {
$allow[] = 'POST';
if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P<param>[^/]++)$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
if (!in_array($requestMethod, array('POST'))) {
$allow = array_merge($allow, array('POST'));
goto not_regex_not_trailing_slash_POST_method;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
return $ret;
}
not_regex_not_trailing_slash_POST_method:
}
if ('/' === $pathinfo && !$allow) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}

0
pfosten/vendor/symfony/routing/Tests/Fixtures/empty.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/file_resource.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/foo.xml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/foo1.xml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/incomplete.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/list_defaults.xml vendored Executable file → Normal file
View file

View file

View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/list_null_values.xml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/map_defaults.xml vendored Executable file → Normal file
View file

View file

View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/map_null_values.xml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/missing_id.xml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/missing_path.xml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/namespaceprefix.xml vendored Executable file → Normal file
View file

View file

View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/nonvalid.xml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/nonvalid.yml vendored Executable file → Normal file
View file

0
pfosten/vendor/symfony/routing/Tests/Fixtures/nonvalid2.yml vendored Executable file → Normal file
View file

Some files were not shown because too many files have changed in this diff Show more