Added Laravel project
This commit is contained in:
3
Laravel/vendor/symfony/routing/.gitignore
vendored
Normal file
3
Laravel/vendor/symfony/routing/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
phpunit.xml
|
146
Laravel/vendor/symfony/routing/Annotation/Route.php
vendored
Normal file
146
Laravel/vendor/symfony/routing/Annotation/Route.php
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Annotation;
|
||||
|
||||
/**
|
||||
* Annotation class for @Route().
|
||||
*
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Route
|
||||
{
|
||||
private $path;
|
||||
private $name;
|
||||
private $requirements = array();
|
||||
private $options = array();
|
||||
private $defaults = array();
|
||||
private $host;
|
||||
private $methods = array();
|
||||
private $schemes = array();
|
||||
private $condition;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $data An array of key/value parameters
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
if (isset($data['value'])) {
|
||||
$data['path'] = $data['value'];
|
||||
unset($data['value']);
|
||||
}
|
||||
|
||||
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)));
|
||||
}
|
||||
$this->$method($value);
|
||||
}
|
||||
}
|
||||
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function setHost($pattern)
|
||||
{
|
||||
$this->host = $pattern;
|
||||
}
|
||||
|
||||
public function getHost()
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setRequirements($requirements)
|
||||
{
|
||||
$this->requirements = $requirements;
|
||||
}
|
||||
|
||||
public function getRequirements()
|
||||
{
|
||||
return $this->requirements;
|
||||
}
|
||||
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
public function setDefaults($defaults)
|
||||
{
|
||||
$this->defaults = $defaults;
|
||||
}
|
||||
|
||||
public function getDefaults()
|
||||
{
|
||||
return $this->defaults;
|
||||
}
|
||||
|
||||
public function setSchemes($schemes)
|
||||
{
|
||||
$this->schemes = is_array($schemes) ? $schemes : array($schemes);
|
||||
}
|
||||
|
||||
public function getSchemes()
|
||||
{
|
||||
return $this->schemes;
|
||||
}
|
||||
|
||||
public function setMethods($methods)
|
||||
{
|
||||
$this->methods = is_array($methods) ? $methods : array($methods);
|
||||
}
|
||||
|
||||
public function getMethods()
|
||||
{
|
||||
return $this->methods;
|
||||
}
|
||||
|
||||
public function setCondition($condition)
|
||||
{
|
||||
$this->condition = $condition;
|
||||
}
|
||||
|
||||
public function getCondition()
|
||||
{
|
||||
return $this->condition;
|
||||
}
|
||||
}
|
219
Laravel/vendor/symfony/routing/CHANGELOG.md
vendored
Normal file
219
Laravel/vendor/symfony/routing/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
* [DEPRECATION] Class parameters have been deprecated and will be removed in 4.0.
|
||||
* router.options.generator_class
|
||||
* router.options.generator_base_class
|
||||
* router.options.generator_dumper_class
|
||||
* router.options.matcher_class
|
||||
* router.options.matcher_base_class
|
||||
* router.options.matcher_dumper_class
|
||||
* router.options.matcher.cache_class
|
||||
* router.options.generator.cache_class
|
||||
|
||||
3.2.0
|
||||
-----
|
||||
|
||||
* Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations.
|
||||
* Added support for UTF-8 requirements
|
||||
|
||||
2.8.0
|
||||
-----
|
||||
|
||||
* allowed specifying a directory to recursively load all routing configuration files it contains
|
||||
* Added ObjectRouteLoader and ServiceRouteLoader that allow routes to be loaded
|
||||
by calling a method on an object/service.
|
||||
* [DEPRECATION] Deprecated the hardcoded value for the `$referenceType` argument of the `UrlGeneratorInterface::generate` method.
|
||||
Use the constants defined in the `UrlGeneratorInterface` instead.
|
||||
|
||||
Before:
|
||||
|
||||
```php
|
||||
$router->generate('blog_show', array('slug' => 'my-blog-post'), true);
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```php
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
$router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
```
|
||||
|
||||
2.5.0
|
||||
-----
|
||||
|
||||
* [DEPRECATION] The `ApacheMatcherDumper` and `ApacheUrlMatcher` were deprecated and
|
||||
will be removed in Symfony 3.0, since the performance gains were minimal and
|
||||
it's hard to replicate the behaviour of PHP implementation.
|
||||
|
||||
2.3.0
|
||||
-----
|
||||
|
||||
* added RequestContext::getQueryString()
|
||||
|
||||
2.2.0
|
||||
-----
|
||||
|
||||
* [DEPRECATION] Several route settings have been renamed (the old ones will be removed in 3.0):
|
||||
|
||||
* The `pattern` setting for a route has been deprecated in favor of `path`
|
||||
* The `_scheme` and `_method` requirements have been moved to the `schemes` and `methods` settings
|
||||
|
||||
Before:
|
||||
|
||||
```yaml
|
||||
article_edit:
|
||||
pattern: /article/{id}
|
||||
requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' }
|
||||
```
|
||||
|
||||
```xml
|
||||
<route id="article_edit" pattern="/article/{id}">
|
||||
<requirement key="_method">POST|PUT</requirement>
|
||||
<requirement key="_scheme">https</requirement>
|
||||
<requirement key="id">\d+</requirement>
|
||||
</route>
|
||||
```
|
||||
|
||||
```php
|
||||
$route = new Route();
|
||||
$route->setPattern('/article/{id}');
|
||||
$route->setRequirement('_method', 'POST|PUT');
|
||||
$route->setRequirement('_scheme', 'https');
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```yaml
|
||||
article_edit:
|
||||
path: /article/{id}
|
||||
methods: [POST, PUT]
|
||||
schemes: https
|
||||
requirements: { 'id': '\d+' }
|
||||
```
|
||||
|
||||
```xml
|
||||
<route id="article_edit" pattern="/article/{id}" methods="POST PUT" schemes="https">
|
||||
<requirement key="id">\d+</requirement>
|
||||
</route>
|
||||
```
|
||||
|
||||
```php
|
||||
$route = new Route();
|
||||
$route->setPath('/article/{id}');
|
||||
$route->setMethods(array('POST', 'PUT'));
|
||||
$route->setSchemes('https');
|
||||
```
|
||||
|
||||
* [BC BREAK] RouteCollection does not behave like a tree structure anymore but as
|
||||
a flat array of Routes. So when using PHP to build the RouteCollection, you must
|
||||
make sure to add routes to the sub-collection before adding it to the parent
|
||||
collection (this is not relevant when using YAML or XML for Route definitions).
|
||||
|
||||
Before:
|
||||
|
||||
```php
|
||||
$rootCollection = new RouteCollection();
|
||||
$subCollection = new RouteCollection();
|
||||
$rootCollection->addCollection($subCollection);
|
||||
$subCollection->add('foo', new Route('/foo'));
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```php
|
||||
$rootCollection = new RouteCollection();
|
||||
$subCollection = new RouteCollection();
|
||||
$subCollection->add('foo', new Route('/foo'));
|
||||
$rootCollection->addCollection($subCollection);
|
||||
```
|
||||
|
||||
Also one must call `addCollection` from the bottom to the top hierarchy.
|
||||
So the correct sequence is the following (and not the reverse):
|
||||
|
||||
```php
|
||||
$childCollection->addCollection($grandchildCollection);
|
||||
$rootCollection->addCollection($childCollection);
|
||||
```
|
||||
|
||||
* [DEPRECATION] The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()`
|
||||
have been deprecated and will be removed in Symfony 2.3.
|
||||
* [BC BREAK] Misusing the `RouteCollection::addPrefix` method to add defaults, requirements
|
||||
or options without adding a prefix is not supported anymore. So if you called `addPrefix`
|
||||
with an empty prefix or `/` only (both have no relevance), like
|
||||
`addPrefix('', $defaultsArray, $requirementsArray, $optionsArray)`
|
||||
you need to use the new dedicated methods `addDefaults($defaultsArray)`,
|
||||
`addRequirements($requirementsArray)` or `addOptions($optionsArray)` instead.
|
||||
* [DEPRECATION] The `$options` parameter to `RouteCollection::addPrefix()` has been deprecated
|
||||
because adding options has nothing to do with adding a path prefix. If you want to add options
|
||||
to all child routes of a RouteCollection, you can use `addOptions()`.
|
||||
* [DEPRECATION] The method `RouteCollection::getPrefix()` has been deprecated
|
||||
because it suggested that all routes in the collection would have this prefix, which is
|
||||
not necessarily true. On top of that, since there is no tree structure anymore, this method
|
||||
is also useless. Don't worry about performance, prefix optimization for matching is still done
|
||||
in the dumper, which was also improved in 2.2.0 to find even more grouping possibilities.
|
||||
* [DEPRECATION] `RouteCollection::addCollection(RouteCollection $collection)` should now only be
|
||||
used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options`
|
||||
will still work, but have been deprecated. The `addPrefix` method should be used for this
|
||||
use-case instead.
|
||||
Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))`
|
||||
After:
|
||||
```php
|
||||
$collection->addPrefix('/prefix', array(...), array(...));
|
||||
$parentCollection->addCollection($collection);
|
||||
```
|
||||
* added support for the method default argument values when defining a @Route
|
||||
* Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`.
|
||||
* Characters that function as separator between placeholders are now whitelisted
|
||||
to fix routes with normal text around a variable, e.g. `/prefix{var}suffix`.
|
||||
* [BC BREAK] The default requirement of a variable has been changed slightly.
|
||||
Previously it disallowed the previous and the next char around a variable. Now
|
||||
it disallows the slash (`/`) and the next char. Using the previous char added
|
||||
no value and was problematic because the route `/index.{_format}` would be
|
||||
matched by `/index.ht/ml`.
|
||||
* The default requirement now uses possessive quantifiers when possible which
|
||||
improves matching performance by up to 20% because it prevents backtracking
|
||||
when it's not needed.
|
||||
* The ConfigurableRequirementsInterface can now also be used to disable the requirements
|
||||
check on URL generation completely by calling `setStrictRequirements(null)`. It
|
||||
improves performance in production environment as you should know that params always
|
||||
pass the requirements (otherwise it would break your link anyway).
|
||||
* There is no restriction on the route name anymore. So non-alphanumeric characters
|
||||
are now also allowed.
|
||||
* [BC BREAK] `RouteCompilerInterface::compile(Route $route)` was made static
|
||||
(only relevant if you implemented your own RouteCompiler).
|
||||
* Added possibility to generate relative paths and network paths in the UrlGenerator, e.g.
|
||||
"../parent-file" and "//example.com/dir/file". The third parameter in
|
||||
`UrlGeneratorInterface::generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)`
|
||||
now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for
|
||||
claritiy. The old method calls with a Boolean parameter will continue to work because they
|
||||
equal the signature using the constants.
|
||||
|
||||
2.1.0
|
||||
-----
|
||||
|
||||
* added RequestMatcherInterface
|
||||
* added RequestContext::fromRequest()
|
||||
* the UrlMatcher does not throw a \LogicException anymore when the required
|
||||
scheme is not the current one
|
||||
* added TraceableUrlMatcher
|
||||
* added the possibility to define options, default values and requirements
|
||||
for placeholders in prefix, including imported routes
|
||||
* added RouterInterface::getRouteCollection
|
||||
* [BC BREAK] the UrlMatcher urldecodes the route parameters only once, they
|
||||
were decoded twice before. Note that the `urldecode()` calls have been
|
||||
changed for a single `rawurldecode()` in order to support `+` for input
|
||||
paths.
|
||||
* added RouteCollection::getRoot method to retrieve the root of a
|
||||
RouteCollection tree
|
||||
* [BC BREAK] made RouteCollection::setParent private which could not have
|
||||
been used anyway without creating inconsistencies
|
||||
* [BC BREAK] RouteCollection::remove also removes a route from parent
|
||||
collections (not only from its children)
|
||||
* added ConfigurableRequirementsInterface that allows to disable exceptions
|
||||
(and generate empty URLs instead) when generating a route with an invalid
|
||||
parameter value
|
171
Laravel/vendor/symfony/routing/CompiledRoute.php
vendored
Normal file
171
Laravel/vendor/symfony/routing/CompiledRoute.php
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
/**
|
||||
* CompiledRoutes are returned by the RouteCompiler class.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class CompiledRoute implements \Serializable
|
||||
{
|
||||
private $variables;
|
||||
private $tokens;
|
||||
private $staticPrefix;
|
||||
private $regex;
|
||||
private $pathVariables;
|
||||
private $hostVariables;
|
||||
private $hostRegex;
|
||||
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
|
||||
* @param array $pathVariables An array of path variables
|
||||
* @param string|null $hostRegex Host regex
|
||||
* @param array $hostTokens Host tokens
|
||||
* @param array $hostVariables An array of host variables
|
||||
* @param array $variables An array of variables (variables defined in the path and in the host patterns)
|
||||
*/
|
||||
public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = array(), array $hostVariables = array(), array $variables = array())
|
||||
{
|
||||
$this->staticPrefix = (string) $staticPrefix;
|
||||
$this->regex = $regex;
|
||||
$this->tokens = $tokens;
|
||||
$this->pathVariables = $pathVariables;
|
||||
$this->hostRegex = $hostRegex;
|
||||
$this->hostTokens = $hostTokens;
|
||||
$this->hostVariables = $hostVariables;
|
||||
$this->variables = $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(array(
|
||||
'vars' => $this->variables,
|
||||
'path_prefix' => $this->staticPrefix,
|
||||
'path_regex' => $this->regex,
|
||||
'path_tokens' => $this->tokens,
|
||||
'path_vars' => $this->pathVariables,
|
||||
'host_regex' => $this->hostRegex,
|
||||
'host_tokens' => $this->hostTokens,
|
||||
'host_vars' => $this->hostVariables,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 70000) {
|
||||
$data = unserialize($serialized, array('allowed_classes' => false));
|
||||
} else {
|
||||
$data = unserialize($serialized);
|
||||
}
|
||||
|
||||
$this->variables = $data['vars'];
|
||||
$this->staticPrefix = $data['path_prefix'];
|
||||
$this->regex = $data['path_regex'];
|
||||
$this->tokens = $data['path_tokens'];
|
||||
$this->pathVariables = $data['path_vars'];
|
||||
$this->hostRegex = $data['host_regex'];
|
||||
$this->hostTokens = $data['host_tokens'];
|
||||
$this->hostVariables = $data['host_vars'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the static prefix.
|
||||
*
|
||||
* @return string The static prefix
|
||||
*/
|
||||
public function getStaticPrefix()
|
||||
{
|
||||
return $this->staticPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the regex.
|
||||
*
|
||||
* @return string The regex
|
||||
*/
|
||||
public function getRegex()
|
||||
{
|
||||
return $this->regex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the host regex.
|
||||
*
|
||||
* @return string|null The host regex or null
|
||||
*/
|
||||
public function getHostRegex()
|
||||
{
|
||||
return $this->hostRegex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tokens.
|
||||
*
|
||||
* @return array The tokens
|
||||
*/
|
||||
public function getTokens()
|
||||
{
|
||||
return $this->tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the host tokens.
|
||||
*
|
||||
* @return array The tokens
|
||||
*/
|
||||
public function getHostTokens()
|
||||
{
|
||||
return $this->hostTokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the variables.
|
||||
*
|
||||
* @return array The variables
|
||||
*/
|
||||
public function getVariables()
|
||||
{
|
||||
return $this->variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path variables.
|
||||
*
|
||||
* @return array The variables
|
||||
*/
|
||||
public function getPathVariables()
|
||||
{
|
||||
return $this->pathVariables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the host variables.
|
||||
*
|
||||
* @return array The variables
|
||||
*/
|
||||
public function getHostVariables()
|
||||
{
|
||||
return $this->hostVariables;
|
||||
}
|
||||
}
|
46
Laravel/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php
vendored
Normal file
46
Laravel/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
|
||||
/**
|
||||
* Adds tagged routing.loader services to routing.resolver service.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class RoutingResolverPass implements CompilerPassInterface
|
||||
{
|
||||
private $resolverServiceId;
|
||||
private $loaderTag;
|
||||
|
||||
public function __construct($resolverServiceId = 'routing.resolver', $loaderTag = 'routing.loader')
|
||||
{
|
||||
$this->resolverServiceId = $resolverServiceId;
|
||||
$this->loaderTag = $loaderTag;
|
||||
}
|
||||
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (false === $container->hasDefinition($this->resolverServiceId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition($this->resolverServiceId);
|
||||
|
||||
foreach ($container->findTaggedServiceIds($this->loaderTag, true) as $id => $attributes) {
|
||||
$definition->addMethodCall('addLoader', array(new Reference($id)));
|
||||
}
|
||||
}
|
||||
}
|
21
Laravel/vendor/symfony/routing/Exception/ExceptionInterface.php
vendored
Normal file
21
Laravel/vendor/symfony/routing/Exception/ExceptionInterface.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Exception;
|
||||
|
||||
/**
|
||||
* ExceptionInterface.
|
||||
*
|
||||
* @author Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
*/
|
||||
interface ExceptionInterface
|
||||
{
|
||||
}
|
21
Laravel/vendor/symfony/routing/Exception/InvalidParameterException.php
vendored
Normal file
21
Laravel/vendor/symfony/routing/Exception/InvalidParameterException.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown when a parameter is not valid.
|
||||
*
|
||||
* @author Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
*/
|
||||
class InvalidParameterException extends \InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
}
|
44
Laravel/vendor/symfony/routing/Exception/MethodNotAllowedException.php
vendored
Normal file
44
Laravel/vendor/symfony/routing/Exception/MethodNotAllowedException.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Exception;
|
||||
|
||||
/**
|
||||
* The resource was found but the request method is not allowed.
|
||||
*
|
||||
* This exception should trigger an HTTP 405 response in your application code.
|
||||
*
|
||||
* @author Kris Wallsmith <kris@symfony.com>
|
||||
*/
|
||||
class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $allowedMethods = array();
|
||||
|
||||
public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null)
|
||||
{
|
||||
$this->allowedMethods = array_map('strtoupper', $allowedMethods);
|
||||
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the allowed HTTP methods.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAllowedMethods()
|
||||
{
|
||||
return $this->allowedMethods;
|
||||
}
|
||||
}
|
22
Laravel/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php
vendored
Normal file
22
Laravel/vendor/symfony/routing/Exception/MissingMandatoryParametersException.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown when a route cannot be generated because of missing
|
||||
* mandatory parameters.
|
||||
*
|
||||
* @author Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
*/
|
||||
class MissingMandatoryParametersException extends \InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
}
|
23
Laravel/vendor/symfony/routing/Exception/ResourceNotFoundException.php
vendored
Normal file
23
Laravel/vendor/symfony/routing/Exception/ResourceNotFoundException.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Exception;
|
||||
|
||||
/**
|
||||
* The resource was not found.
|
||||
*
|
||||
* This exception should trigger an HTTP 404 response in your application code.
|
||||
*
|
||||
* @author Kris Wallsmith <kris@symfony.com>
|
||||
*/
|
||||
class ResourceNotFoundException extends \RuntimeException implements ExceptionInterface
|
||||
{
|
||||
}
|
21
Laravel/vendor/symfony/routing/Exception/RouteNotFoundException.php
vendored
Normal file
21
Laravel/vendor/symfony/routing/Exception/RouteNotFoundException.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Exception;
|
||||
|
||||
/**
|
||||
* Exception thrown when a route does not exist.
|
||||
*
|
||||
* @author Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
*/
|
||||
class RouteNotFoundException extends \InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
}
|
55
Laravel/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php
vendored
Normal file
55
Laravel/vendor/symfony/routing/Generator/ConfigurableRequirementsInterface.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator;
|
||||
|
||||
/**
|
||||
* ConfigurableRequirementsInterface must be implemented by URL generators that
|
||||
* can be configured whether an exception should be generated when the parameters
|
||||
* do not match the requirements. It is also possible to disable the requirements
|
||||
* check for URL generation completely.
|
||||
*
|
||||
* The possible configurations and use-cases:
|
||||
* - setStrictRequirements(true): Throw an exception for mismatching requirements. This
|
||||
* is mostly useful in development environment.
|
||||
* - setStrictRequirements(false): Don't throw an exception but return null as URL for
|
||||
* mismatching requirements and log the problem. Useful when you cannot control all
|
||||
* params because they come from third party libs but don't want to have a 404 in
|
||||
* production environment. It should log the mismatch so one can review it.
|
||||
* - setStrictRequirements(null): Return the URL with the given parameters without
|
||||
* checking the requirements at all. When generating a URL you should either trust
|
||||
* your params or you validated them beforehand because otherwise it would break your
|
||||
* link anyway. So in production environment you should know that params always pass
|
||||
* the requirements. Thus this option allows to disable the check on URL generation for
|
||||
* performance reasons (saving a preg_match for each requirement every time a URL is
|
||||
* generated).
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
interface ConfigurableRequirementsInterface
|
||||
{
|
||||
/**
|
||||
* Enables or disables the exception on incorrect parameters.
|
||||
* Passing null will deactivate the requirements check completely.
|
||||
*
|
||||
* @param bool|null $enabled
|
||||
*/
|
||||
public function setStrictRequirements($enabled);
|
||||
|
||||
/**
|
||||
* Returns whether to throw an exception on incorrect parameters.
|
||||
* Null means the requirements check is deactivated completely.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function isStrictRequirements();
|
||||
}
|
45
Laravel/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php
vendored
Normal file
45
Laravel/vendor/symfony/routing/Generator/Dumper/GeneratorDumper.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator\Dumper;
|
||||
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* GeneratorDumper is the base class for all built-in generator dumpers.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRoutes()
|
||||
{
|
||||
return $this->routes;
|
||||
}
|
||||
}
|
39
Laravel/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php
vendored
Normal file
39
Laravel/vendor/symfony/routing/Generator/Dumper/GeneratorDumperInterface.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator\Dumper;
|
||||
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* GeneratorDumperInterface is the interface that all generator dumper classes must implement.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface GeneratorDumperInterface
|
||||
{
|
||||
/**
|
||||
* Dumps a set of routes to a string representation of executable code
|
||||
* that can then be used to generate a URL of such a route.
|
||||
*
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string Executable code
|
||||
*/
|
||||
public function dump(array $options = array());
|
||||
|
||||
/**
|
||||
* Gets the routes to dump.
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*/
|
||||
public function getRoutes();
|
||||
}
|
123
Laravel/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php
vendored
Normal file
123
Laravel/vendor/symfony/routing/Generator/Dumper/PhpGeneratorDumper.php
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator\Dumper;
|
||||
|
||||
/**
|
||||
* PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class PhpGeneratorDumper extends GeneratorDumper
|
||||
{
|
||||
/**
|
||||
* Dumps a set of routes to a PHP class.
|
||||
*
|
||||
* Available options:
|
||||
*
|
||||
* * class: The class name
|
||||
* * base_class: The base class name
|
||||
*
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string A PHP class representing the generator class
|
||||
*/
|
||||
public function dump(array $options = array())
|
||||
{
|
||||
$options = array_merge(array(
|
||||
'class' => 'ProjectUrlGenerator',
|
||||
'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
|
||||
), $options);
|
||||
|
||||
return <<<EOF
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* {$options['class']}
|
||||
*
|
||||
* This class has been auto-generated
|
||||
* by the Symfony Routing Component.
|
||||
*/
|
||||
class {$options['class']} extends {$options['base_class']}
|
||||
{
|
||||
private static \$declaredRoutes;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct(RequestContext \$context, LoggerInterface \$logger = null)
|
||||
{
|
||||
\$this->context = \$context;
|
||||
\$this->logger = \$logger;
|
||||
if (null === self::\$declaredRoutes) {
|
||||
self::\$declaredRoutes = {$this->generateDeclaredRoutes()};
|
||||
}
|
||||
}
|
||||
|
||||
{$this->generateGenerateMethod()}
|
||||
}
|
||||
|
||||
EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates PHP code representing an array of defined routes
|
||||
* together with the routes properties (e.g. requirements).
|
||||
*
|
||||
* @return string PHP code
|
||||
*/
|
||||
private function generateDeclaredRoutes()
|
||||
{
|
||||
$routes = "array(\n";
|
||||
foreach ($this->getRoutes()->all() as $name => $route) {
|
||||
$compiledRoute = $route->compile();
|
||||
|
||||
$properties = array();
|
||||
$properties[] = $compiledRoute->getVariables();
|
||||
$properties[] = $route->getDefaults();
|
||||
$properties[] = $route->getRequirements();
|
||||
$properties[] = $compiledRoute->getTokens();
|
||||
$properties[] = $compiledRoute->getHostTokens();
|
||||
$properties[] = $route->getSchemes();
|
||||
|
||||
$routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true)));
|
||||
}
|
||||
$routes .= ' )';
|
||||
|
||||
return $routes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates PHP code representing the `generate` method that implements the UrlGeneratorInterface.
|
||||
*
|
||||
* @return string PHP code
|
||||
*/
|
||||
private function generateGenerateMethod()
|
||||
{
|
||||
return <<<'EOF'
|
||||
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
|
||||
{
|
||||
if (!isset(self::$declaredRoutes[$name])) {
|
||||
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
|
||||
}
|
||||
|
||||
list($variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes) = self::$declaredRoutes[$name];
|
||||
|
||||
return $this->doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
|
||||
}
|
||||
EOF;
|
||||
}
|
||||
}
|
339
Laravel/vendor/symfony/routing/Generator/UrlGenerator.php
vendored
Normal file
339
Laravel/vendor/symfony/routing/Generator/UrlGenerator.php
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* UrlGenerator can generate a URL or a path for any route in the RouteCollection
|
||||
* based on the passed parameters.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInterface
|
||||
{
|
||||
/**
|
||||
* @var RouteCollection
|
||||
*/
|
||||
protected $routes;
|
||||
|
||||
/**
|
||||
* @var RequestContext
|
||||
*/
|
||||
protected $context;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
protected $strictRequirements = true;
|
||||
|
||||
/**
|
||||
* @var LoggerInterface|null
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL.
|
||||
*
|
||||
* PHP's rawurlencode() encodes all chars except "a-zA-Z0-9-._~" according to RFC 3986. But we want to allow some chars
|
||||
* to be used in their literal form (reasons below). Other chars inside the path must of course be encoded, e.g.
|
||||
* "?" and "#" (would be interpreted wrongly as query and fragment identifier),
|
||||
* "'" and """ (are used as delimiters in HTML).
|
||||
*/
|
||||
protected $decodedChars = array(
|
||||
// the slash can be used to designate a hierarchical structure and we want allow using it with this meaning
|
||||
// some webservers don't allow the slash in encoded form in the path for security reasons anyway
|
||||
// see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss
|
||||
'%2F' => '/',
|
||||
// the following chars are general delimiters in the URI specification but have only special meaning in the authority component
|
||||
// so they can safely be used in the path in unencoded form
|
||||
'%40' => '@',
|
||||
'%3A' => ':',
|
||||
// these chars are only sub-delimiters that have no predefined meaning and can therefore be used literally
|
||||
// so URI producing applications can use these chars to delimit subcomponents in a path segment without being encoded for better readability
|
||||
'%3B' => ';',
|
||||
'%2C' => ',',
|
||||
'%3D' => '=',
|
||||
'%2B' => '+',
|
||||
'%21' => '!',
|
||||
'%2A' => '*',
|
||||
'%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;
|
||||
$this->context = $context;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContext(RequestContext $context)
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setStrictRequirements($enabled)
|
||||
{
|
||||
$this->strictRequirements = null === $enabled ? null : (bool) $enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isStrictRequirements()
|
||||
{
|
||||
return $this->strictRequirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
|
||||
{
|
||||
if (null === $route = $this->routes->get($name)) {
|
||||
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
|
||||
}
|
||||
|
||||
// the Route has a cache of its own and is not recompiled as long as it does not get modified
|
||||
$compiledRoute = $route->compile();
|
||||
|
||||
return $this->doGenerate($compiledRoute->getVariables(), $route->getDefaults(), $route->getRequirements(), $compiledRoute->getTokens(), $parameters, $name, $referenceType, $compiledRoute->getHostTokens(), $route->getSchemes());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
|
||||
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
|
||||
* it does not match the requirement
|
||||
*/
|
||||
protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array())
|
||||
{
|
||||
$variables = array_flip($variables);
|
||||
$mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters);
|
||||
|
||||
// all params must be given
|
||||
if ($diff = array_diff_key($variables, $mergedParams)) {
|
||||
throw new MissingMandatoryParametersException(sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', array_keys($diff)), $name));
|
||||
}
|
||||
|
||||
$url = '';
|
||||
$optional = true;
|
||||
$message = 'Parameter "{parameter}" for route "{route}" must match "{expected}" ("{given}" given) to generate a corresponding URL.';
|
||||
foreach ($tokens as $token) {
|
||||
if ('variable' === $token[0]) {
|
||||
if (!$optional || !array_key_exists($token[3], $defaults) || null !== $mergedParams[$token[3]] && (string) $mergedParams[$token[3]] !== (string) $defaults[$token[3]]) {
|
||||
// check requirement
|
||||
if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#'.(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;
|
||||
}
|
||||
|
||||
$url = $token[1].$mergedParams[$token[3]].$url;
|
||||
$optional = false;
|
||||
}
|
||||
} else {
|
||||
// static text
|
||||
$url = $token[1].$url;
|
||||
$optional = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ('' === $url) {
|
||||
$url = '/';
|
||||
}
|
||||
|
||||
// the contexts base URL is already encoded (see Symfony\Component\HttpFoundation\Request)
|
||||
$url = strtr(rawurlencode($url), $this->decodedChars);
|
||||
|
||||
// the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3
|
||||
// so we need to encode them as they are not used for this purpose here
|
||||
// otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route
|
||||
$url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/'));
|
||||
if ('/..' === substr($url, -3)) {
|
||||
$url = substr($url, 0, -2).'%2E%2E';
|
||||
} elseif ('/.' === substr($url, -2)) {
|
||||
$url = substr($url, 0, -1).'%2E';
|
||||
}
|
||||
|
||||
$schemeAuthority = '';
|
||||
if ($host = $this->context->getHost()) {
|
||||
$scheme = $this->context->getScheme();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
$routeHost = $token[1].$mergedParams[$token[3]].$routeHost;
|
||||
} else {
|
||||
$routeHost = $token[1].$routeHost;
|
||||
}
|
||||
}
|
||||
|
||||
if ($routeHost !== $host) {
|
||||
$host = $routeHost;
|
||||
if (self::ABSOLUTE_URL !== $referenceType) {
|
||||
$referenceType = self::NETWORK_PATH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
$schemeAuthority = self::NETWORK_PATH === $referenceType ? '//' : "$scheme://";
|
||||
$schemeAuthority .= $host.$port;
|
||||
}
|
||||
}
|
||||
|
||||
if (self::RELATIVE_PATH === $referenceType) {
|
||||
$url = self::getRelativePath($this->context->getPathInfo(), $url);
|
||||
} else {
|
||||
$url = $schemeAuthority.$this->context->getBaseUrl().$url;
|
||||
}
|
||||
|
||||
// add a query string if needed
|
||||
$extra = array_udiff_assoc(array_diff_key($parameters, $variables), $defaults, function ($a, $b) {
|
||||
return $a == $b ? 0 : 1;
|
||||
});
|
||||
|
||||
// extract fragment
|
||||
$fragment = '';
|
||||
if (isset($defaults['_fragment'])) {
|
||||
$fragment = $defaults['_fragment'];
|
||||
}
|
||||
|
||||
if (isset($extra['_fragment'])) {
|
||||
$fragment = $extra['_fragment'];
|
||||
unset($extra['_fragment']);
|
||||
}
|
||||
|
||||
if ($extra && $query = http_build_query($extra, '', '&', PHP_QUERY_RFC3986)) {
|
||||
// "/" and "?" can be left decoded for better user experience, see
|
||||
// http://tools.ietf.org/html/rfc3986#section-3.4
|
||||
$url .= '?'.strtr($query, array('%2F' => '/'));
|
||||
}
|
||||
|
||||
if ('' !== $fragment) {
|
||||
$url .= '#'.strtr(rawurlencode($fragment), array('%2F' => '/', '%3F' => '?'));
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the target path as relative reference from the base path.
|
||||
*
|
||||
* Only the URIs path component (no schema, host etc.) is relevant and must be given, starting with a slash.
|
||||
* Both paths must be absolute and not contain relative parts.
|
||||
* Relative URLs from one resource to another are useful when generating self-contained downloadable document archives.
|
||||
* Furthermore, they can be used to reduce the link size in documents.
|
||||
*
|
||||
* Example target paths, given a base path of "/a/b/c/d":
|
||||
* - "/a/b/c/d" -> ""
|
||||
* - "/a/b/c/" -> "./"
|
||||
* - "/a/b/" -> "../"
|
||||
* - "/a/b/c/other" -> "other"
|
||||
* - "/a/x/y" -> "../../x/y"
|
||||
*
|
||||
* @param string $basePath The base path
|
||||
* @param string $targetPath The target path
|
||||
*
|
||||
* @return string The relative target path
|
||||
*/
|
||||
public static function getRelativePath($basePath, $targetPath)
|
||||
{
|
||||
if ($basePath === $targetPath) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath);
|
||||
$targetDirs = explode('/', isset($targetPath[0]) && '/' === $targetPath[0] ? substr($targetPath, 1) : $targetPath);
|
||||
array_pop($sourceDirs);
|
||||
$targetFile = array_pop($targetDirs);
|
||||
|
||||
foreach ($sourceDirs as $i => $dir) {
|
||||
if (isset($targetDirs[$i]) && $dir === $targetDirs[$i]) {
|
||||
unset($sourceDirs[$i], $targetDirs[$i]);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$targetDirs[] = $targetFile;
|
||||
$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
|
||||
// as the first segment of a relative-path reference, as it would be mistaken for a scheme name
|
||||
// (see http://tools.ietf.org/html/rfc3986#section-4.2).
|
||||
return '' === $path || '/' === $path[0]
|
||||
|| false !== ($colonPos = strpos($path, ':')) && ($colonPos < ($slashPos = strpos($path, '/')) || false === $slashPos)
|
||||
? "./$path" : $path;
|
||||
}
|
||||
}
|
86
Laravel/vendor/symfony/routing/Generator/UrlGeneratorInterface.php
vendored
Normal file
86
Laravel/vendor/symfony/routing/Generator/UrlGeneratorInterface.php
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Generator;
|
||||
|
||||
use Symfony\Component\Routing\Exception\InvalidParameterException;
|
||||
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
use Symfony\Component\Routing\RequestContextAwareInterface;
|
||||
|
||||
/**
|
||||
* UrlGeneratorInterface is the interface that all URL generator classes must implement.
|
||||
*
|
||||
* The constants in this interface define the different types of resource references that
|
||||
* are declared in RFC 3986: http://tools.ietf.org/html/rfc3986
|
||||
* We are using the term "URL" instead of "URI" as this is more common in web applications
|
||||
* and we do not need to distinguish them as the difference is mostly semantical and
|
||||
* less technical. Generating URIs, i.e. representation-independent resource identifiers,
|
||||
* is also possible.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
interface UrlGeneratorInterface extends RequestContextAwareInterface
|
||||
{
|
||||
/**
|
||||
* Generates an absolute URL, e.g. "http://example.com/dir/file".
|
||||
*/
|
||||
const ABSOLUTE_URL = 0;
|
||||
|
||||
/**
|
||||
* Generates an absolute path, e.g. "/dir/file".
|
||||
*/
|
||||
const ABSOLUTE_PATH = 1;
|
||||
|
||||
/**
|
||||
* Generates a relative path based on the current request path, e.g. "../parent-file".
|
||||
*
|
||||
* @see UrlGenerator::getRelativePath()
|
||||
*/
|
||||
const RELATIVE_PATH = 2;
|
||||
|
||||
/**
|
||||
* Generates a network path, e.g. "//example.com/dir/file".
|
||||
* Such reference reuses the current scheme but specifies the host.
|
||||
*/
|
||||
const NETWORK_PATH = 3;
|
||||
|
||||
/**
|
||||
* Generates a URL or path for a specific route based on the given parameters.
|
||||
*
|
||||
* Parameters that reference placeholders in the route pattern will substitute them in the
|
||||
* path or host. Extra params are added as query string to the URL.
|
||||
*
|
||||
* When the passed reference type cannot be generated for the route because it requires a different
|
||||
* host or scheme than the current one, the method will return a more comprehensive reference
|
||||
* that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH
|
||||
* but the route requires the https scheme whereas the current scheme is http, it will instead return an
|
||||
* ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches
|
||||
* the route in any case.
|
||||
*
|
||||
* If there is no route with the given name, the generator must throw the RouteNotFoundException.
|
||||
*
|
||||
* The special parameter _fragment will be used as the document fragment suffixed to the final URL.
|
||||
*
|
||||
* @param string $name The name of the route
|
||||
* @param mixed $parameters An array of parameters
|
||||
* @param int $referenceType The type of reference to be generated (one of the constants)
|
||||
*
|
||||
* @return string The generated URL
|
||||
*
|
||||
* @throws RouteNotFoundException If the named route doesn't exist
|
||||
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
|
||||
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
|
||||
* it does not match the requirement
|
||||
*/
|
||||
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH);
|
||||
}
|
19
Laravel/vendor/symfony/routing/LICENSE
vendored
Normal file
19
Laravel/vendor/symfony/routing/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2004-2017 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
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
270
Laravel/vendor/symfony/routing/Loader/AnnotationClassLoader.php
vendored
Normal file
270
Laravel/vendor/symfony/routing/Loader/AnnotationClassLoader.php
vendored
Normal file
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Loader;
|
||||
|
||||
use Doctrine\Common\Annotations\Reader;
|
||||
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.
|
||||
*
|
||||
* You need to define an implementation for the getRouteDefaults() method. Most of the
|
||||
* time, this method should define some PHP callable to be called for the route
|
||||
* (a controller in MVC speak).
|
||||
*
|
||||
* The @Route annotation can be set on the class (for global parameters),
|
||||
* and on each method.
|
||||
*
|
||||
* The @Route annotation main value is the route path. The annotation also
|
||||
* recognizes several parameters: requirements, options, defaults, schemes,
|
||||
* methods, host, and name. The name parameter is mandatory.
|
||||
* Here is an example of how you should be able to use it:
|
||||
*
|
||||
* /**
|
||||
* * @Route("/Blog")
|
||||
* * /
|
||||
* class Blog
|
||||
* {
|
||||
* /**
|
||||
* * @Route("/", name="blog_index")
|
||||
* * /
|
||||
* public function index()
|
||||
* {
|
||||
* }
|
||||
*
|
||||
* /**
|
||||
* * @Route("/{id}", name="blog_post", requirements = {"id" = "\d+"})
|
||||
* * /
|
||||
* public function show()
|
||||
* {
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
abstract class AnnotationClassLoader implements LoaderInterface
|
||||
{
|
||||
/**
|
||||
* @var Reader
|
||||
*/
|
||||
protected $reader;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $routeAnnotationClass = 'Symfony\\Component\\Routing\\Annotation\\Route';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $defaultRouteIndex = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Reader $reader
|
||||
*/
|
||||
public function __construct(Reader $reader)
|
||||
{
|
||||
$this->reader = $reader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the annotation class to read route properties from.
|
||||
*
|
||||
* @param string $class A fully-qualified class name
|
||||
*/
|
||||
public function setRouteAnnotationClass($class)
|
||||
{
|
||||
$this->routeAnnotationClass = $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads from annotations from a class.
|
||||
*
|
||||
* @param string $class A class name
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When route can't be parsed
|
||||
*/
|
||||
public function load($class, $type = null)
|
||||
{
|
||||
if (!class_exists($class)) {
|
||||
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
|
||||
}
|
||||
|
||||
$class = new \ReflectionClass($class);
|
||||
if ($class->isAbstract()) {
|
||||
throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class->getName()));
|
||||
}
|
||||
|
||||
$globals = $this->getGlobals($class);
|
||||
|
||||
$collection = new RouteCollection();
|
||||
$collection->addResource(new FileResource($class->getFileName()));
|
||||
|
||||
foreach ($class->getMethods() as $method) {
|
||||
$this->defaultRouteIndex = 0;
|
||||
foreach ($this->reader->getMethodAnnotations($method) as $annot) {
|
||||
if ($annot instanceof $this->routeAnnotationClass) {
|
||||
$this->addRoute($collection, $annot, $globals, $class, $method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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'));
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method)
|
||||
{
|
||||
$name = $annot->getName();
|
||||
if (null === $name) {
|
||||
$name = $this->getDefaultRouteName($class, $method);
|
||||
}
|
||||
|
||||
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
|
||||
foreach ($method->getParameters() as $param) {
|
||||
if (false !== strpos($globals['path'].$annot->getPath(), sprintf('{%s}', $param->getName())) && !isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) {
|
||||
$defaults[$param->getName()] = $param->getDefaultValue();
|
||||
}
|
||||
}
|
||||
$requirements = array_replace($globals['requirements'], $annot->getRequirements());
|
||||
$options = array_replace($globals['options'], $annot->getOptions());
|
||||
$schemes = array_merge($globals['schemes'], $annot->getSchemes());
|
||||
$methods = array_merge($globals['methods'], $annot->getMethods());
|
||||
|
||||
$host = $annot->getHost();
|
||||
if (null === $host) {
|
||||
$host = $globals['host'];
|
||||
}
|
||||
|
||||
$condition = $annot->getCondition();
|
||||
if (null === $condition) {
|
||||
$condition = $globals['condition'];
|
||||
}
|
||||
|
||||
$route = $this->createRoute($globals['path'].$annot->getPath(), $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
|
||||
|
||||
$this->configureRoute($route, $class, $method, $annot);
|
||||
|
||||
$collection->add($name, $route);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setResolver(LoaderResolverInterface $resolver)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResolver()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default route name for a class method.
|
||||
*
|
||||
* @param \ReflectionClass $class
|
||||
* @param \ReflectionMethod $method
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
|
||||
{
|
||||
$name = strtolower(str_replace('\\', '_', $class->name).'_'.$method->name);
|
||||
if ($this->defaultRouteIndex > 0) {
|
||||
$name .= '_'.$this->defaultRouteIndex;
|
||||
}
|
||||
++$this->defaultRouteIndex;
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
protected function getGlobals(\ReflectionClass $class)
|
||||
{
|
||||
$globals = array(
|
||||
'path' => '',
|
||||
'requirements' => array(),
|
||||
'options' => array(),
|
||||
'defaults' => array(),
|
||||
'schemes' => array(),
|
||||
'methods' => array(),
|
||||
'host' => '',
|
||||
'condition' => '',
|
||||
);
|
||||
|
||||
if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) {
|
||||
if (null !== $annot->getPath()) {
|
||||
$globals['path'] = $annot->getPath();
|
||||
}
|
||||
|
||||
if (null !== $annot->getRequirements()) {
|
||||
$globals['requirements'] = $annot->getRequirements();
|
||||
}
|
||||
|
||||
if (null !== $annot->getOptions()) {
|
||||
$globals['options'] = $annot->getOptions();
|
||||
}
|
||||
|
||||
if (null !== $annot->getDefaults()) {
|
||||
$globals['defaults'] = $annot->getDefaults();
|
||||
}
|
||||
|
||||
if (null !== $annot->getSchemes()) {
|
||||
$globals['schemes'] = $annot->getSchemes();
|
||||
}
|
||||
|
||||
if (null !== $annot->getMethods()) {
|
||||
$globals['methods'] = $annot->getMethods();
|
||||
}
|
||||
|
||||
if (null !== $annot->getHost()) {
|
||||
$globals['host'] = $annot->getHost();
|
||||
}
|
||||
|
||||
if (null !== $annot->getCondition()) {
|
||||
$globals['condition'] = $annot->getCondition();
|
||||
}
|
||||
}
|
||||
|
||||
return $globals;
|
||||
}
|
||||
|
||||
protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition)
|
||||
{
|
||||
return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
|
||||
}
|
||||
|
||||
abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot);
|
||||
}
|
89
Laravel/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php
vendored
Normal file
89
Laravel/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Loader;
|
||||
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
|
||||
/**
|
||||
* AnnotationDirectoryLoader loads routing information from annotations set
|
||||
* on PHP classes and methods.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class AnnotationDirectoryLoader extends AnnotationFileLoader
|
||||
{
|
||||
/**
|
||||
* Loads from annotations from a directory.
|
||||
*
|
||||
* @param string $path A directory path
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed
|
||||
*/
|
||||
public function load($path, $type = null)
|
||||
{
|
||||
$dir = $this->locator->locate($path);
|
||||
|
||||
$collection = new RouteCollection();
|
||||
$collection->addResource(new DirectoryResource($dir, '/\.php$/'));
|
||||
$files = iterator_to_array(new \RecursiveIteratorIterator(
|
||||
new \RecursiveCallbackFilterIterator(
|
||||
new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS),
|
||||
function (\SplFileInfo $current) {
|
||||
return '.' !== substr($current->getBasename(), 0, 1);
|
||||
}
|
||||
),
|
||||
\RecursiveIteratorIterator::LEAVES_ONLY
|
||||
));
|
||||
usort($files, function (\SplFileInfo $a, \SplFileInfo $b) {
|
||||
return (string) $a > (string) $b ? 1 : -1;
|
||||
});
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($class = $this->findClass($file)) {
|
||||
$refl = new \ReflectionClass($class);
|
||||
if ($refl->isAbstract()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$collection->addCollection($this->loader->load($class, $type));
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
if (!is_string($resource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$path = $this->locator->locate($resource);
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return is_dir($path) && (!$type || 'annotation' === $type);
|
||||
}
|
||||
}
|
147
Laravel/vendor/symfony/routing/Loader/AnnotationFileLoader.php
vendored
Normal file
147
Laravel/vendor/symfony/routing/Loader/AnnotationFileLoader.php
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* AnnotationFileLoader loads routing information from annotations set
|
||||
* on a PHP class and its methods.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
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')) {
|
||||
throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.');
|
||||
}
|
||||
|
||||
parent::__construct($locator);
|
||||
|
||||
$this->loader = $loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads from annotations from a file.
|
||||
*
|
||||
* @param string $file A PHP file path
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
$collection = new RouteCollection();
|
||||
if ($class = $this->findClass($path)) {
|
||||
$collection->addResource(new FileResource($path));
|
||||
$collection->addCollection($this->loader->load($class, $type));
|
||||
}
|
||||
if (\PHP_VERSION_ID >= 70000) {
|
||||
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
||||
gc_mem_caches();
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full class name for the first class in the file.
|
||||
*
|
||||
* @param string $file A PHP file path
|
||||
*
|
||||
* @return string|false Full class name if found, false otherwise
|
||||
*/
|
||||
protected function findClass($file)
|
||||
{
|
||||
$class = false;
|
||||
$namespace = false;
|
||||
$tokens = token_get_all(file_get_contents($file));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
for ($i = 0; isset($tokens[$i]); ++$i) {
|
||||
$token = $tokens[$i];
|
||||
|
||||
if (!isset($token[1])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (true === $class && T_STRING === $token[0]) {
|
||||
return $namespace.'\\'.$token[1];
|
||||
}
|
||||
|
||||
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))) {
|
||||
$namespace .= $tokens[$i][1];
|
||||
}
|
||||
$token = $tokens[$i];
|
||||
}
|
||||
|
||||
if (T_CLASS === $token[0]) {
|
||||
// Skip usage of ::class constant
|
||||
$isClassConstant = false;
|
||||
for ($j = $i - 1; $j > 0; --$j) {
|
||||
if (!isset($tokens[$j][1])) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (T_DOUBLE_COLON === $tokens[$j][0]) {
|
||||
$isClassConstant = true;
|
||||
break;
|
||||
} elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$isClassConstant) {
|
||||
$class = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (T_NAMESPACE === $token[0]) {
|
||||
$namespace = true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
46
Laravel/vendor/symfony/routing/Loader/ClosureLoader.php
vendored
Normal file
46
Laravel/vendor/symfony/routing/Loader/ClosureLoader.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Loader;
|
||||
|
||||
use Symfony\Component\Config\Loader\Loader;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* ClosureLoader loads routes from a PHP closure.
|
||||
*
|
||||
* The Closure must return a RouteCollection instance.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class ClosureLoader extends Loader
|
||||
{
|
||||
/**
|
||||
* Loads a Closure.
|
||||
*
|
||||
* @param \Closure $closure A Closure
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*/
|
||||
public function load($closure, $type = null)
|
||||
{
|
||||
return $closure();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
return $resource instanceof \Closure && (!$type || 'closure' === $type);
|
||||
}
|
||||
}
|
40
Laravel/vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php
vendored
Normal file
40
Laravel/vendor/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Loader\DependencyInjection;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\Routing\Loader\ObjectRouteLoader;
|
||||
|
||||
/**
|
||||
* A route loader that executes a service to load the routes.
|
||||
*
|
||||
* This depends on the DependencyInjection component.
|
||||
*
|
||||
* @author Ryan Weaver <ryan@knpuniversity.com>
|
||||
*/
|
||||
class ServiceRouterLoader extends ObjectRouteLoader
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
protected function getServiceObject($id)
|
||||
{
|
||||
return $this->container->get($id);
|
||||
}
|
||||
}
|
58
Laravel/vendor/symfony/routing/Loader/DirectoryLoader.php
vendored
Normal file
58
Laravel/vendor/symfony/routing/Loader/DirectoryLoader.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Loader;
|
||||
|
||||
use Symfony\Component\Config\Loader\FileLoader;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
||||
|
||||
class DirectoryLoader extends FileLoader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
$collection = new RouteCollection();
|
||||
$collection->addResource(new DirectoryResource($path));
|
||||
|
||||
foreach (scandir($path) as $dir) {
|
||||
if ('.' !== $dir[0]) {
|
||||
$this->setCurrentDir($path);
|
||||
$subPath = $path.'/'.$dir;
|
||||
$subType = null;
|
||||
|
||||
if (is_dir($subPath)) {
|
||||
$subPath .= '/';
|
||||
$subType = 'directory';
|
||||
}
|
||||
|
||||
$subCollection = $this->import($subPath, $subType, false, $path);
|
||||
$collection->addCollection($subCollection);
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
// only when type is forced to directory, not to conflict with AnnotationLoader
|
||||
|
||||
return 'directory' === $type;
|
||||
}
|
||||
}
|
95
Laravel/vendor/symfony/routing/Loader/ObjectRouteLoader.php
vendored
Normal file
95
Laravel/vendor/symfony/routing/Loader/ObjectRouteLoader.php
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Loader;
|
||||
|
||||
use Symfony\Component\Config\Loader\Loader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* A route loader that calls a method on an object to load the routes.
|
||||
*
|
||||
* @author Ryan Weaver <ryan@knpuniversity.com>
|
||||
*/
|
||||
abstract class ObjectRouteLoader extends Loader
|
||||
{
|
||||
/**
|
||||
* Returns the object that the method will be called on to load routes.
|
||||
*
|
||||
* For example, if your application uses a service container,
|
||||
* the $id may be a service id.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
abstract protected function getServiceObject($id);
|
||||
|
||||
/**
|
||||
* Calls the service that will load the routes.
|
||||
*
|
||||
* @param mixed $resource Some value that will resolve to a callable
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @return RouteCollection
|
||||
*/
|
||||
public function load($resource, $type = null)
|
||||
{
|
||||
$parts = explode(':', $resource);
|
||||
if (count($parts) != 2) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName"', $resource));
|
||||
}
|
||||
|
||||
$serviceString = $parts[0];
|
||||
$method = $parts[1];
|
||||
|
||||
$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 (!method_exists($loaderObject, $method)) {
|
||||
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);
|
||||
|
||||
if (!$routeCollection instanceof 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));
|
||||
}
|
||||
|
||||
// make the service file tracked so that if it changes, the cache rebuilds
|
||||
$this->addClassResource(new \ReflectionClass($loaderObject), $routeCollection);
|
||||
|
||||
return $routeCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
return 'service' === $type;
|
||||
}
|
||||
|
||||
private function addClassResource(\ReflectionClass $class, RouteCollection $collection)
|
||||
{
|
||||
do {
|
||||
if (is_file($class->getFileName())) {
|
||||
$collection->addResource(new FileResource($class->getFileName()));
|
||||
}
|
||||
} while ($class = $class->getParentClass());
|
||||
}
|
||||
}
|
66
Laravel/vendor/symfony/routing/Loader/PhpFileLoader.php
vendored
Normal file
66
Laravel/vendor/symfony/routing/Loader/PhpFileLoader.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Loader;
|
||||
|
||||
use Symfony\Component\Config\Loader\FileLoader;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* PhpFileLoader loads routes from a PHP file.
|
||||
*
|
||||
* The file must return a RouteCollection instance.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class PhpFileLoader extends FileLoader
|
||||
{
|
||||
/**
|
||||
* Loads a PHP file.
|
||||
*
|
||||
* @param string $file A PHP file path
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
$this->setCurrentDir(dirname($path));
|
||||
|
||||
$collection = self::includeFile($path, $this);
|
||||
$collection->addResource(new FileResource($path));
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
342
Laravel/vendor/symfony/routing/Loader/XmlFileLoader.php
vendored
Normal file
342
Laravel/vendor/symfony/routing/Loader/XmlFileLoader.php
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
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\Util\XmlUtils;
|
||||
|
||||
/**
|
||||
* XmlFileLoader loads XML routing files.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class XmlFileLoader extends FileLoader
|
||||
{
|
||||
const NAMESPACE_URI = 'http://symfony.com/schema/routing';
|
||||
const SCHEME_PATH = '/schema/routing/routing-1.0.xsd';
|
||||
|
||||
/**
|
||||
* Loads an XML file.
|
||||
*
|
||||
* @param string $file An XML file path
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
$xml = $this->loadFile($path);
|
||||
|
||||
$collection = new RouteCollection();
|
||||
$collection->addResource(new FileResource($path));
|
||||
|
||||
// process routes and imports
|
||||
foreach ($xml->documentElement->childNodes as $node) {
|
||||
if (!$node instanceof \DOMElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->parseNode($collection, $node, $path, $file);
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a node from a loaded XML file.
|
||||
*
|
||||
* @param RouteCollection $collection Collection to associate with the node
|
||||
* @param \DOMElement $node Element to parse
|
||||
* @param string $path Full path of the XML file being processed
|
||||
* @param string $file Loaded file name
|
||||
*
|
||||
* @throws \InvalidArgumentException When the XML is invalid
|
||||
*/
|
||||
protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file)
|
||||
{
|
||||
if (self::NAMESPACE_URI !== $node->namespaceURI) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($node->localName) {
|
||||
case 'route':
|
||||
$this->parseRoute($collection, $node, $path);
|
||||
break;
|
||||
case 'import':
|
||||
$this->parseImport($collection, $node, $path, $file);
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "route" or "import".', $node->localName, $path));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a route and adds it to the RouteCollection.
|
||||
*
|
||||
* @param RouteCollection $collection RouteCollection instance
|
||||
* @param \DOMElement $node Element to parse that represents a Route
|
||||
* @param string $path Full path of the XML file being processed
|
||||
*
|
||||
* @throws \InvalidArgumentException When the XML is invalid
|
||||
*/
|
||||
protected function parseRoute(RouteCollection $collection, \DOMElement $node, $path)
|
||||
{
|
||||
if ('' === ($id = $node->getAttribute('id')) || !$node->hasAttribute('path')) {
|
||||
throw new \InvalidArgumentException(sprintf('The <route> element in file "%s" must have an "id" and a "path" attribute.', $path));
|
||||
}
|
||||
|
||||
$schemes = preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY);
|
||||
$methods = preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path);
|
||||
|
||||
$route = new Route($node->getAttribute('path'), $defaults, $requirements, $options, $node->getAttribute('host'), $schemes, $methods, $condition);
|
||||
$collection->add($id, $route);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an import and adds the routes in the resource to the RouteCollection.
|
||||
*
|
||||
* @param RouteCollection $collection RouteCollection instance
|
||||
* @param \DOMElement $node Element to parse that represents a Route
|
||||
* @param string $path Full path of the XML file being processed
|
||||
* @param string $file Loaded file name
|
||||
*
|
||||
* @throws \InvalidArgumentException When the XML is invalid
|
||||
*/
|
||||
protected function parseImport(RouteCollection $collection, \DOMElement $node, $path, $file)
|
||||
{
|
||||
if ('' === $resource = $node->getAttribute('resource')) {
|
||||
throw new \InvalidArgumentException(sprintf('The <import> element in file "%s" must have a "resource" attribute.', $path));
|
||||
}
|
||||
|
||||
$type = $node->getAttribute('type');
|
||||
$prefix = $node->getAttribute('prefix');
|
||||
$host = $node->hasAttribute('host') ? $node->getAttribute('host') : null;
|
||||
$schemes = $node->hasAttribute('schemes') ? preg_split('/[\s,\|]++/', $node->getAttribute('schemes'), -1, PREG_SPLIT_NO_EMPTY) : null;
|
||||
$methods = $node->hasAttribute('methods') ? preg_split('/[\s,\|]++/', $node->getAttribute('methods'), -1, PREG_SPLIT_NO_EMPTY) : null;
|
||||
|
||||
list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $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);
|
||||
|
||||
$collection->addCollection($subCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads an XML file.
|
||||
*
|
||||
* @param string $file An XML file path
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*
|
||||
* @throws \InvalidArgumentException When loading of XML file fails because of syntax errors
|
||||
* or when the XML structure is not as expected by the scheme -
|
||||
* see validate()
|
||||
*/
|
||||
protected function loadFile($file)
|
||||
{
|
||||
return XmlUtils::loadFile($file, __DIR__.static::SCHEME_PATH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the config elements (default, requirement, option).
|
||||
*
|
||||
* @param \DOMElement $node Element to parse that contains the configs
|
||||
* @param string $path Full path of the XML file being processed
|
||||
*
|
||||
* @return array An array with the defaults as first item, requirements as second and options as third
|
||||
*
|
||||
* @throws \InvalidArgumentException When the XML is invalid
|
||||
*/
|
||||
private function parseConfigs(\DOMElement $node, $path)
|
||||
{
|
||||
$defaults = array();
|
||||
$requirements = array();
|
||||
$options = array();
|
||||
$condition = null;
|
||||
|
||||
foreach ($node->getElementsByTagNameNS(self::NAMESPACE_URI, '*') as $n) {
|
||||
if ($node !== $n->parentNode) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($n->localName) {
|
||||
case 'default':
|
||||
if ($this->isElementValueNull($n)) {
|
||||
$defaults[$n->getAttribute('key')] = null;
|
||||
} else {
|
||||
$defaults[$n->getAttribute('key')] = $this->parseDefaultsConfig($n, $path);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'requirement':
|
||||
$requirements[$n->getAttribute('key')] = trim($n->textContent);
|
||||
break;
|
||||
case 'option':
|
||||
$options[$n->getAttribute('key')] = trim($n->textContent);
|
||||
break;
|
||||
case 'condition':
|
||||
$condition = trim($n->textContent);
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "default", "requirement", "option" or "condition".', $n->localName, $path));
|
||||
}
|
||||
}
|
||||
|
||||
return array($defaults, $requirements, $options, $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the "default" elements.
|
||||
*
|
||||
* @param \DOMElement $element The "default" element to parse
|
||||
* @param string $path Full path of the XML file being processed
|
||||
*
|
||||
* @return array|bool|float|int|string|null The parsed value of the "default" element
|
||||
*/
|
||||
private function parseDefaultsConfig(\DOMElement $element, $path)
|
||||
{
|
||||
if ($this->isElementValueNull($element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for existing element nodes in the default element. There can
|
||||
// only be a single element inside a default element. So this element
|
||||
// (if one was found) can safely be returned.
|
||||
foreach ($element->childNodes as $child) {
|
||||
if (!$child instanceof \DOMElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self::NAMESPACE_URI !== $child->namespaceURI) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return $this->parseDefaultNode($child, $path);
|
||||
}
|
||||
|
||||
// If the default element doesn't contain a nested "bool", "int", "float",
|
||||
// "string", "list", or "map" element, the element contents will be treated
|
||||
// as the string value of the associated default option.
|
||||
return trim($element->textContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively parses the value of a "default" element.
|
||||
*
|
||||
* @param \DOMElement $node The node value
|
||||
* @param string $path Full path of the XML file being processed
|
||||
*
|
||||
* @return array|bool|float|int|string The parsed value
|
||||
*
|
||||
* @throws \InvalidArgumentException when the XML is invalid
|
||||
*/
|
||||
private function parseDefaultNode(\DOMElement $node, $path)
|
||||
{
|
||||
if ($this->isElementValueNull($node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($node->localName) {
|
||||
case 'bool':
|
||||
return 'true' === trim($node->nodeValue) || '1' === trim($node->nodeValue);
|
||||
case 'int':
|
||||
return (int) trim($node->nodeValue);
|
||||
case 'float':
|
||||
return (float) trim($node->nodeValue);
|
||||
case 'string':
|
||||
return trim($node->nodeValue);
|
||||
case 'list':
|
||||
$list = array();
|
||||
|
||||
foreach ($node->childNodes as $element) {
|
||||
if (!$element instanceof \DOMElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self::NAMESPACE_URI !== $element->namespaceURI) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$list[] = $this->parseDefaultNode($element, $path);
|
||||
}
|
||||
|
||||
return $list;
|
||||
case 'map':
|
||||
$map = array();
|
||||
|
||||
foreach ($node->childNodes as $element) {
|
||||
if (!$element instanceof \DOMElement) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self::NAMESPACE_URI !== $element->namespaceURI) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$map[$element->getAttribute('key')] = $this->parseDefaultNode($element, $path);
|
||||
}
|
||||
|
||||
return $map;
|
||||
default:
|
||||
throw new \InvalidArgumentException(sprintf('Unknown tag "%s" used in file "%s". Expected "bool", "int", "float", "string", "list", or "map".', $node->localName, $path));
|
||||
}
|
||||
}
|
||||
|
||||
private function isElementValueNull(\DOMElement $element)
|
||||
{
|
||||
$namespaceUri = 'http://www.w3.org/2001/XMLSchema-instance';
|
||||
|
||||
if (!$element->hasAttributeNS($namespaceUri, 'nil')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 'true' === $element->getAttributeNS($namespaceUri, 'nil') || '1' === $element->getAttributeNS($namespaceUri, 'nil');
|
||||
}
|
||||
}
|
208
Laravel/vendor/symfony/routing/Loader/YamlFileLoader.php
vendored
Normal file
208
Laravel/vendor/symfony/routing/Loader/YamlFileLoader.php
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Loader;
|
||||
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
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.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class YamlFileLoader extends FileLoader
|
||||
{
|
||||
private static $availableKeys = array(
|
||||
'resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition',
|
||||
);
|
||||
private $yamlParser;
|
||||
|
||||
/**
|
||||
* Loads a Yaml file.
|
||||
*
|
||||
* @param string $file A Yaml file path
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid
|
||||
*/
|
||||
public function load($file, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
if (!stream_is_local($path)) {
|
||||
throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path));
|
||||
}
|
||||
|
||||
if (!file_exists($path)) {
|
||||
throw new \InvalidArgumentException(sprintf('File "%s" not found.', $path));
|
||||
}
|
||||
|
||||
if (null === $this->yamlParser) {
|
||||
$this->yamlParser = new YamlParser();
|
||||
}
|
||||
|
||||
try {
|
||||
$parsedConfig = $this->yamlParser->parse(file_get_contents($path), Yaml::PARSE_KEYS_AS_STRINGS);
|
||||
} catch (ParseException $e) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
|
||||
}
|
||||
|
||||
$collection = new RouteCollection();
|
||||
$collection->addResource(new FileResource($path));
|
||||
|
||||
// empty file
|
||||
if (null === $parsedConfig) {
|
||||
return $collection;
|
||||
}
|
||||
|
||||
// not an array
|
||||
if (!is_array($parsedConfig)) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path));
|
||||
}
|
||||
|
||||
foreach ($parsedConfig as $name => $config) {
|
||||
$this->validate($config, $name, $path);
|
||||
|
||||
if (isset($config['resource'])) {
|
||||
$this->parseImport($collection, $config, $path, $file);
|
||||
} else {
|
||||
$this->parseRoute($collection, $name, $config, $path);
|
||||
}
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, $type = null)
|
||||
{
|
||||
return is_string($resource) && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a route and adds it to the RouteCollection.
|
||||
*
|
||||
* @param RouteCollection $collection A RouteCollection instance
|
||||
* @param string $name Route name
|
||||
* @param array $config Route definition
|
||||
* @param string $path Full path of the YAML file being processed
|
||||
*/
|
||||
protected function parseRoute(RouteCollection $collection, $name, array $config, $path)
|
||||
{
|
||||
$defaults = isset($config['defaults']) ? $config['defaults'] : array();
|
||||
$requirements = isset($config['requirements']) ? $config['requirements'] : array();
|
||||
$options = isset($config['options']) ? $config['options'] : array();
|
||||
$host = isset($config['host']) ? $config['host'] : '';
|
||||
$schemes = isset($config['schemes']) ? $config['schemes'] : array();
|
||||
$methods = isset($config['methods']) ? $config['methods'] : array();
|
||||
$condition = isset($config['condition']) ? $config['condition'] : null;
|
||||
|
||||
$route = new Route($config['path'], $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
|
||||
|
||||
$collection->add($name, $route);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an import and adds the routes in the resource to the RouteCollection.
|
||||
*
|
||||
* @param RouteCollection $collection A RouteCollection instance
|
||||
* @param array $config Route definition
|
||||
* @param string $path Full path of the YAML file being processed
|
||||
* @param string $file Loaded file name
|
||||
*/
|
||||
protected function parseImport(RouteCollection $collection, array $config, $path, $file)
|
||||
{
|
||||
$type = isset($config['type']) ? $config['type'] : null;
|
||||
$prefix = isset($config['prefix']) ? $config['prefix'] : '';
|
||||
$defaults = isset($config['defaults']) ? $config['defaults'] : array();
|
||||
$requirements = isset($config['requirements']) ? $config['requirements'] : array();
|
||||
$options = isset($config['options']) ? $config['options'] : array();
|
||||
$host = isset($config['host']) ? $config['host'] : null;
|
||||
$condition = isset($config['condition']) ? $config['condition'] : null;
|
||||
$schemes = isset($config['schemes']) ? $config['schemes'] : null;
|
||||
$methods = isset($config['methods']) ? $config['methods'] : null;
|
||||
|
||||
$this->setCurrentDir(dirname($path));
|
||||
|
||||
$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);
|
||||
|
||||
$collection->addCollection($subCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the route configuration.
|
||||
*
|
||||
* @param array $config A resource config
|
||||
* @param string $name The config key
|
||||
* @param string $path The loaded file path
|
||||
*
|
||||
* @throws \InvalidArgumentException If one of the provided config keys is not supported,
|
||||
* something is missing or the combination is nonsense
|
||||
*/
|
||||
protected function validate($config, $name, $path)
|
||||
{
|
||||
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)) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".',
|
||||
$path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys)
|
||||
));
|
||||
}
|
||||
if (isset($config['resource']) && isset($config['path'])) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.',
|
||||
$path, $name
|
||||
));
|
||||
}
|
||||
if (!isset($config['resource']) && isset($config['type'])) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.',
|
||||
$name, $path
|
||||
));
|
||||
}
|
||||
if (!isset($config['resource']) && !isset($config['path'])) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'You must define a "path" for the route "%s" in file "%s".',
|
||||
$name, $path
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
146
Laravel/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd
vendored
Normal file
146
Laravel/vendor/symfony/routing/Loader/schema/routing/routing-1.0.xsd
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<xsd:schema xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://symfony.com/schema/routing"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Symfony XML Routing Schema, version 1.0
|
||||
Authors: Fabien Potencier, Tobias Schultze
|
||||
|
||||
This scheme defines the elements and attributes that can be used to define
|
||||
routes. A route maps an HTTP request to a set of configuration variables.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:element name="routes" type="routes" />
|
||||
|
||||
<xsd:complexType name="routes">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="import" type="import" />
|
||||
<xsd:element name="route" type="route" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:group name="configs">
|
||||
<xsd:choice>
|
||||
<xsd:element name="default" nillable="true" type="default" />
|
||||
<xsd:element name="requirement" type="element" />
|
||||
<xsd:element name="option" type="element" />
|
||||
<xsd:element name="condition" type="xsd:string" />
|
||||
</xsd:choice>
|
||||
</xsd:group>
|
||||
|
||||
<xsd:complexType name="route">
|
||||
<xsd:group ref="configs" minOccurs="0" maxOccurs="unbounded" />
|
||||
|
||||
<xsd:attribute name="id" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="path" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="host" type="xsd:string" />
|
||||
<xsd:attribute name="schemes" type="xsd:string" />
|
||||
<xsd:attribute name="methods" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="import">
|
||||
<xsd:group ref="configs" minOccurs="0" maxOccurs="unbounded" />
|
||||
|
||||
<xsd:attribute name="resource" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="prefix" type="xsd:string" />
|
||||
<xsd:attribute name="host" type="xsd:string" />
|
||||
<xsd:attribute name="schemes" type="xsd:string" />
|
||||
<xsd:attribute name="methods" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="default" mixed="true">
|
||||
<xsd:choice minOccurs="0" maxOccurs="1">
|
||||
<xsd:element name="bool" type="xsd:boolean" />
|
||||
<xsd:element name="int" type="xsd:integer" />
|
||||
<xsd:element name="float" type="xsd:float" />
|
||||
<xsd:element name="string" type="xsd:string" />
|
||||
<xsd:element name="list" type="list" />
|
||||
<xsd:element name="map" type="map" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="element">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="list">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="bool" nillable="true" type="xsd:boolean" />
|
||||
<xsd:element name="int" nillable="true" type="xsd:integer" />
|
||||
<xsd:element name="float" nillable="true" type="xsd:float" />
|
||||
<xsd:element name="string" nillable="true" type="xsd:string" />
|
||||
<xsd:element name="list" nillable="true" type="list" />
|
||||
<xsd:element name="map" nillable="true" type="map" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="map">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="bool" nillable="true" type="map-bool-entry" />
|
||||
<xsd:element name="int" nillable="true" type="map-int-entry" />
|
||||
<xsd:element name="float" nillable="true" type="map-float-entry" />
|
||||
<xsd:element name="string" nillable="true" type="map-string-entry" />
|
||||
<xsd:element name="list" nillable="true" type="map-list-entry" />
|
||||
<xsd:element name="map" nillable="true" type="map-map-entry" />
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="map-bool-entry">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:boolean">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="map-int-entry">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:integer">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="map-float-entry">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:float">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="map-string-entry">
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="map-list-entry">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="list">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="map-map-entry">
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="map">
|
||||
<xsd:attribute name="key" type="xsd:string" use="required" />
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
161
Laravel/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php
vendored
Normal file
161
Laravel/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher\Dumper;
|
||||
|
||||
/**
|
||||
* Collection of routes.
|
||||
*
|
||||
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class DumperCollection implements \IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* @var DumperCollection|null
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* @var DumperCollection[]|DumperRoute[]
|
||||
*/
|
||||
private $children = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $attributes = array();
|
||||
|
||||
/**
|
||||
* Returns the children routes and collections.
|
||||
*
|
||||
* @return self[]|DumperRoute[]
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a route or collection.
|
||||
*
|
||||
* @param DumperRoute|DumperCollection The route or collection
|
||||
*/
|
||||
public function add($child)
|
||||
{
|
||||
if ($child instanceof self) {
|
||||
$child->setParent($this);
|
||||
}
|
||||
$this->children[] = $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets children.
|
||||
*
|
||||
* @param array $children The children
|
||||
*/
|
||||
public function setAll(array $children)
|
||||
{
|
||||
foreach ($children as $child) {
|
||||
if ($child instanceof self) {
|
||||
$child->setParent($this);
|
||||
}
|
||||
}
|
||||
$this->children = $children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator over the children.
|
||||
*
|
||||
* @return \Iterator|DumperCollection[]|DumperRoute[] The iterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->children);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the root of the collection.
|
||||
*
|
||||
* @return self The root collection
|
||||
*/
|
||||
public function getRoot()
|
||||
{
|
||||
return (null !== $this->parent) ? $this->parent->getRoot() : $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent collection.
|
||||
*
|
||||
* @return self|null The parent collection or null if the collection has no parent
|
||||
*/
|
||||
protected function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parent collection.
|
||||
*
|
||||
* @param DumperCollection $parent The parent collection
|
||||
*/
|
||||
protected function setParent(DumperCollection $parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the attribute is defined.
|
||||
*
|
||||
* @param string $name The attribute name
|
||||
*
|
||||
* @return bool true if the attribute is defined, false otherwise
|
||||
*/
|
||||
public function hasAttribute($name)
|
||||
{
|
||||
return array_key_exists($name, $this->attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an attribute by name.
|
||||
*
|
||||
* @param string $name The attribute name
|
||||
* @param mixed $default Default value is the attribute doesn't exist
|
||||
*
|
||||
* @return mixed The attribute value
|
||||
*/
|
||||
public function getAttribute($name, $default = null)
|
||||
{
|
||||
return $this->hasAttribute($name) ? $this->attributes[$name] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an attribute by name.
|
||||
*
|
||||
* @param string $name The attribute name
|
||||
* @param mixed $value The attribute value
|
||||
*/
|
||||
public function setAttribute($name, $value)
|
||||
{
|
||||
$this->attributes[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets multiple attributes.
|
||||
*
|
||||
* @param array $attributes The attributes
|
||||
*/
|
||||
public function setAttributes($attributes)
|
||||
{
|
||||
$this->attributes = $attributes;
|
||||
}
|
||||
}
|
66
Laravel/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php
vendored
Normal file
66
Laravel/vendor/symfony/routing/Matcher/Dumper/DumperRoute.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher\Dumper;
|
||||
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* Container for a Route.
|
||||
*
|
||||
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class DumperRoute
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var Route
|
||||
*/
|
||||
private $route;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name The route name
|
||||
* @param Route $route The route
|
||||
*/
|
||||
public function __construct($name, Route $route)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->route = $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the route name.
|
||||
*
|
||||
* @return string The route name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the route.
|
||||
*
|
||||
* @return Route The route
|
||||
*/
|
||||
public function getRoute()
|
||||
{
|
||||
return $this->route;
|
||||
}
|
||||
}
|
45
Laravel/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php
vendored
Normal file
45
Laravel/vendor/symfony/routing/Matcher/Dumper/MatcherDumper.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher\Dumper;
|
||||
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* MatcherDumper is the abstract class for all built-in matcher dumpers.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRoutes()
|
||||
{
|
||||
return $this->routes;
|
||||
}
|
||||
}
|
39
Laravel/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php
vendored
Normal file
39
Laravel/vendor/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher\Dumper;
|
||||
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* MatcherDumperInterface is the interface that all matcher dumper classes must implement.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface MatcherDumperInterface
|
||||
{
|
||||
/**
|
||||
* Dumps a set of routes to a string representation of executable code
|
||||
* that can then be used to match a request against these routes.
|
||||
*
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string Executable code
|
||||
*/
|
||||
public function dump(array $options = array());
|
||||
|
||||
/**
|
||||
* Gets the routes to dump.
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*/
|
||||
public function getRoutes();
|
||||
}
|
431
Laravel/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php
vendored
Normal file
431
Laravel/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php
vendored
Normal file
@@ -0,0 +1,431 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher\Dumper;
|
||||
|
||||
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.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
||||
*/
|
||||
class PhpMatcherDumper extends MatcherDumper
|
||||
{
|
||||
private $expressionLanguage;
|
||||
|
||||
/**
|
||||
* @var ExpressionFunctionProviderInterface[]
|
||||
*/
|
||||
private $expressionLanguageProviders = array();
|
||||
|
||||
/**
|
||||
* Dumps a set of routes to a PHP class.
|
||||
*
|
||||
* Available options:
|
||||
*
|
||||
* * class: The class name
|
||||
* * base_class: The base class name
|
||||
*
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @return string A PHP class representing the matcher class
|
||||
*/
|
||||
public function dump(array $options = array())
|
||||
{
|
||||
$options = array_replace(array(
|
||||
'class' => 'ProjectUrlMatcher',
|
||||
'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
|
||||
), $options);
|
||||
|
||||
// trailing slash support is only enabled if we know how to redirect the user
|
||||
$interfaces = class_implements($options['base_class']);
|
||||
$supportsRedirections = isset($interfaces['Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface']);
|
||||
|
||||
return <<<EOF
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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;
|
||||
}
|
||||
|
||||
{$this->generateMatchMethod($supportsRedirections)}
|
||||
}
|
||||
|
||||
EOF;
|
||||
}
|
||||
|
||||
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
|
||||
{
|
||||
$this->expressionLanguageProviders[] = $provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the code for the match method implementing UrlMatcherInterface.
|
||||
*
|
||||
* @param bool $supportsRedirections Whether redirections are supported by the base class
|
||||
*
|
||||
* @return string Match method as PHP code
|
||||
*/
|
||||
private function generateMatchMethod($supportsRedirections)
|
||||
{
|
||||
$code = rtrim($this->compileRoutes($this->getRoutes(), $supportsRedirections), "\n");
|
||||
|
||||
return <<<EOF
|
||||
public function match(\$pathinfo)
|
||||
{
|
||||
\$allow = array();
|
||||
\$pathinfo = rawurldecode(\$pathinfo);
|
||||
\$trimmedPathinfo = rtrim(\$pathinfo, '/');
|
||||
\$context = \$this->context;
|
||||
\$request = \$this->request;
|
||||
\$requestMethod = \$canonicalMethod = \$context->getMethod();
|
||||
\$scheme = \$context->getScheme();
|
||||
|
||||
if ('HEAD' === \$requestMethod) {
|
||||
\$canonicalMethod = 'GET';
|
||||
}
|
||||
|
||||
|
||||
$code
|
||||
|
||||
throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates PHP code to match a RouteCollection with all its routes.
|
||||
*
|
||||
* @param RouteCollection $routes A RouteCollection instance
|
||||
* @param bool $supportsRedirections Whether redirections are supported by the base class
|
||||
*
|
||||
* @return string PHP code
|
||||
*/
|
||||
private function compileRoutes(RouteCollection $routes, $supportsRedirections)
|
||||
{
|
||||
$fetchedHost = false;
|
||||
$groups = $this->groupRoutesByHostRegex($routes);
|
||||
$code = '';
|
||||
|
||||
foreach ($groups as $collection) {
|
||||
if (null !== $regex = $collection->getAttribute('host_regex')) {
|
||||
if (!$fetchedHost) {
|
||||
$code .= " \$host = \$context->getHost();\n\n";
|
||||
$fetchedHost = true;
|
||||
}
|
||||
|
||||
$code .= sprintf(" if (preg_match(%s, \$host, \$hostMatches)) {\n", var_export($regex, true));
|
||||
}
|
||||
|
||||
$tree = $this->buildStaticPrefixCollection($collection);
|
||||
$groupCode = $this->compileStaticPrefixRoutes($tree, $supportsRedirections);
|
||||
|
||||
if (null !== $regex) {
|
||||
// apply extra indention at each line (except empty ones)
|
||||
$groupCode = preg_replace('/^.{2,}$/m', ' $0', $groupCode);
|
||||
$code .= $groupCode;
|
||||
$code .= " }\n\n";
|
||||
} else {
|
||||
$code .= $groupCode;
|
||||
}
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
private function buildStaticPrefixCollection(DumperCollection $collection)
|
||||
{
|
||||
$prefixCollection = new StaticPrefixCollection();
|
||||
|
||||
foreach ($collection as $dumperRoute) {
|
||||
$prefix = $dumperRoute->getRoute()->compile()->getStaticPrefix();
|
||||
$prefixCollection->addRoute($prefix, $dumperRoute);
|
||||
}
|
||||
|
||||
$prefixCollection->optimizeGroups();
|
||||
|
||||
return $prefixCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates PHP code to match a tree of routes.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @return string PHP code
|
||||
*/
|
||||
private function compileStaticPrefixRoutes(StaticPrefixCollection $collection, $supportsRedirections, $ifOrElseIf = 'if')
|
||||
{
|
||||
$code = '';
|
||||
$prefix = $collection->getPrefix();
|
||||
|
||||
if (!empty($prefix) && '/' !== $prefix) {
|
||||
$code .= sprintf(" %s (0 === strpos(\$pathinfo, %s)) {\n", $ifOrElseIf, var_export($prefix, true));
|
||||
}
|
||||
|
||||
$ifOrElseIf = 'if';
|
||||
|
||||
foreach ($collection->getItems() as $route) {
|
||||
if ($route instanceof StaticPrefixCollection) {
|
||||
$code .= $this->compileStaticPrefixRoutes($route, $supportsRedirections, $ifOrElseIf);
|
||||
$ifOrElseIf = 'elseif';
|
||||
} else {
|
||||
$code .= $this->compileRoute($route[1]->getRoute(), $route[1]->getName(), $supportsRedirections, $prefix)."\n";
|
||||
$ifOrElseIf = 'if';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($prefix) && '/' !== $prefix) {
|
||||
$code .= " }\n\n";
|
||||
// apply extra indention at each line (except empty ones)
|
||||
$code = preg_replace('/^.{2,}$/m', ' $0', $code);
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a single Route to PHP code used to match it against the path info.
|
||||
*
|
||||
* @param Route $route A Route instance
|
||||
* @param string $name The name of the Route
|
||||
* @param bool $supportsRedirections Whether redirections are supported by the base class
|
||||
* @param string|null $parentPrefix The prefix of the parent collection used to optimize the code
|
||||
*
|
||||
* @return string PHP code
|
||||
*
|
||||
* @throws \LogicException
|
||||
*/
|
||||
private function compileRoute(Route $route, $name, $supportsRedirections, $parentPrefix = null)
|
||||
{
|
||||
$code = '';
|
||||
$compiledRoute = $route->compile();
|
||||
$conditions = array();
|
||||
$hasTrailingSlash = false;
|
||||
$matches = false;
|
||||
$hostMatches = false;
|
||||
$methods = $route->getMethods();
|
||||
|
||||
$supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('HEAD', $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) === '/') {
|
||||
$conditions[] = sprintf('%s === $trimmedPathinfo', var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true));
|
||||
$hasTrailingSlash = true;
|
||||
} else {
|
||||
$conditions[] = sprintf('%s === $pathinfo', var_export(str_replace('\\', '', $m['url']), true));
|
||||
}
|
||||
} else {
|
||||
if ($compiledRoute->getStaticPrefix() && $compiledRoute->getStaticPrefix() !== $parentPrefix) {
|
||||
$conditions[] = sprintf('0 === strpos($pathinfo, %s)', var_export($compiledRoute->getStaticPrefix(), true));
|
||||
}
|
||||
|
||||
if ($supportsTrailingSlash && $pos = strpos($regex, '/$')) {
|
||||
$regex = substr($regex, 0, $pos).'/?$'.substr($regex, $pos + 2);
|
||||
$hasTrailingSlash = true;
|
||||
}
|
||||
$conditions[] = sprintf('preg_match(%s, $pathinfo, $matches)', var_export($regex, true));
|
||||
|
||||
$matches = true;
|
||||
}
|
||||
|
||||
if ($compiledRoute->getHostVariables()) {
|
||||
$hostMatches = true;
|
||||
}
|
||||
|
||||
if ($route->getCondition()) {
|
||||
$conditions[] = $this->getExpressionLanguage()->compile($route->getCondition(), array('context', 'request'));
|
||||
}
|
||||
|
||||
$conditions = implode(' && ', $conditions);
|
||||
|
||||
$code .= <<<EOF
|
||||
// $name
|
||||
if ($conditions) {
|
||||
|
||||
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_values(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;
|
||||
}
|
||||
|
||||
// optimize parameters array
|
||||
if ($matches || $hostMatches) {
|
||||
$vars = array();
|
||||
if ($hostMatches) {
|
||||
$vars[] = '$hostMatches';
|
||||
}
|
||||
if ($matches) {
|
||||
$vars[] = '$matches';
|
||||
}
|
||||
$vars[] = "array('_route' => '$name')";
|
||||
|
||||
$code .= sprintf(
|
||||
" return \$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)));
|
||||
} else {
|
||||
$code .= sprintf(" return array('_route' => '%s');\n", $name);
|
||||
}
|
||||
$code .= " }\n";
|
||||
|
||||
if ($methods) {
|
||||
$code .= " $gotoname:\n";
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups consecutive routes having the same host regex.
|
||||
*
|
||||
* The result is a collection of collections of routes having the same host regex.
|
||||
*
|
||||
* @param RouteCollection $routes A flat RouteCollection
|
||||
*
|
||||
* @return DumperCollection A collection with routes grouped by host regex in sub-collections
|
||||
*/
|
||||
private function groupRoutesByHostRegex(RouteCollection $routes)
|
||||
{
|
||||
$groups = new DumperCollection();
|
||||
$currentGroup = new DumperCollection();
|
||||
$currentGroup->setAttribute('host_regex', null);
|
||||
$groups->add($currentGroup);
|
||||
|
||||
foreach ($routes as $name => $route) {
|
||||
$hostRegex = $route->compile()->getHostRegex();
|
||||
if ($currentGroup->getAttribute('host_regex') !== $hostRegex) {
|
||||
$currentGroup = new DumperCollection();
|
||||
$currentGroup->setAttribute('host_regex', $hostRegex);
|
||||
$groups->add($currentGroup);
|
||||
}
|
||||
$currentGroup->add(new DumperRoute($name, $route));
|
||||
}
|
||||
|
||||
return $groups;
|
||||
}
|
||||
|
||||
private function getExpressionLanguage()
|
||||
{
|
||||
if (null === $this->expressionLanguage) {
|
||||
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
|
||||
throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
|
||||
}
|
||||
$this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
|
||||
}
|
||||
|
||||
return $this->expressionLanguage;
|
||||
}
|
||||
}
|
238
Laravel/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php
vendored
Normal file
238
Laravel/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher\Dumper;
|
||||
|
||||
/**
|
||||
* Prefix tree of routes preserving routes order.
|
||||
*
|
||||
* @author Frank de Jonge <info@frankdejonge.nl>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class StaticPrefixCollection
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $prefix;
|
||||
|
||||
/**
|
||||
* @var array[]|StaticPrefixCollection[]
|
||||
*/
|
||||
private $items = array();
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $matchStart = 0;
|
||||
|
||||
public function __construct($prefix = '')
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
}
|
||||
|
||||
public function getPrefix()
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]|StaticPrefixCollection[]
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a route to a group.
|
||||
*
|
||||
* @param string $prefix
|
||||
* @param mixed $route
|
||||
*/
|
||||
public function addRoute($prefix, $route)
|
||||
{
|
||||
$prefix = '/' === $prefix ? $prefix : rtrim($prefix, '/');
|
||||
$this->guardAgainstAddingNotAcceptedRoutes($prefix);
|
||||
|
||||
if ($this->prefix === $prefix) {
|
||||
// When a prefix is exactly the same as the base we move up the match start position.
|
||||
// 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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->items as $i => $item) {
|
||||
if ($i < $this->matchStart) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item instanceof self && $item->accepts($prefix)) {
|
||||
$item->addRoute($prefix, $route);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$group = $this->groupWithItem($item, $prefix, $route);
|
||||
|
||||
if ($group instanceof self) {
|
||||
$this->items[$i] = $group;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// No optimised case was found, in this case we simple add the route for possible
|
||||
// grouping when new routes are added.
|
||||
$this->items[] = array($prefix, $route);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to combine a route with another route or group.
|
||||
*
|
||||
* @param StaticPrefixCollection|array $item
|
||||
* @param string $prefix
|
||||
* @param mixed $route
|
||||
*
|
||||
* @return null|StaticPrefixCollection
|
||||
*/
|
||||
private function groupWithItem($item, $prefix, $route)
|
||||
{
|
||||
$itemPrefix = $item instanceof self ? $item->prefix : $item[0];
|
||||
$commonPrefix = $this->detectCommonPrefix($prefix, $itemPrefix);
|
||||
|
||||
if (!$commonPrefix) {
|
||||
return;
|
||||
}
|
||||
|
||||
$child = new self($commonPrefix);
|
||||
|
||||
if ($item instanceof self) {
|
||||
$child->items = array($item);
|
||||
} else {
|
||||
$child->addRoute($item[0], $item[1]);
|
||||
}
|
||||
|
||||
$child->addRoute($prefix, $route);
|
||||
|
||||
return $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a prefix can be contained within the group.
|
||||
*
|
||||
* @param string $prefix
|
||||
*
|
||||
* @return bool Whether a prefix could belong in a given group
|
||||
*/
|
||||
private function accepts($prefix)
|
||||
{
|
||||
return '' === $this->prefix || strpos($prefix, $this->prefix) === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects whether there's a common prefix relative to the group prefix and returns it.
|
||||
*
|
||||
* @param string $prefix
|
||||
* @param string $anotherPrefix
|
||||
*
|
||||
* @return false|string A common prefix, longer than the base/group prefix, or false when none available
|
||||
*/
|
||||
private function detectCommonPrefix($prefix, $anotherPrefix)
|
||||
{
|
||||
$baseLength = strlen($this->prefix);
|
||||
$commonLength = $baseLength;
|
||||
$end = min(strlen($prefix), strlen($anotherPrefix));
|
||||
|
||||
for ($i = $baseLength; $i <= $end; ++$i) {
|
||||
if (substr($prefix, 0, $i) !== substr($anotherPrefix, 0, $i)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$commonLength = $i;
|
||||
}
|
||||
|
||||
$commonPrefix = rtrim(substr($prefix, 0, $commonLength), '/');
|
||||
|
||||
if (strlen($commonPrefix) > $baseLength) {
|
||||
return $commonPrefix;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimizes the tree by inlining items from groups with less than 3 items.
|
||||
*/
|
||||
public function optimizeGroups()
|
||||
{
|
||||
$index = -1;
|
||||
|
||||
while (isset($this->items[++$index])) {
|
||||
$item = $this->items[$index];
|
||||
|
||||
if ($item instanceof self) {
|
||||
$item->optimizeGroups();
|
||||
|
||||
// When a group contains only two items there's no reason to optimize because at minimum
|
||||
// the amount of prefix check is 2. In this case inline the group.
|
||||
if ($item->shouldBeInlined()) {
|
||||
array_splice($this->items, $index, 1, $item->items);
|
||||
|
||||
// Lower index to pass through the same index again after optimizing.
|
||||
// The first item of the replacements might be a group needing optimization.
|
||||
--$index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function shouldBeInlined()
|
||||
{
|
||||
if (count($this->items) >= 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if ($item instanceof self) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if (is_array($item) && $item[0] === $this->prefix) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Guards against adding incompatible prefixes in a group.
|
||||
*
|
||||
* @param string $prefix
|
||||
*
|
||||
* @throws \LogicException When a prefix does not belong in a group.
|
||||
*/
|
||||
private function guardAgainstAddingNotAcceptedRoutes($prefix)
|
||||
{
|
||||
if (!$this->accepts($prefix)) {
|
||||
$message = sprintf('Could not add route with prefix %s to collection with prefix %s', $prefix, $this->prefix);
|
||||
|
||||
throw new \LogicException($message);
|
||||
}
|
||||
}
|
||||
}
|
65
Laravel/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php
vendored
Normal file
65
Laravel/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher;
|
||||
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function match($pathinfo)
|
||||
{
|
||||
try {
|
||||
$parameters = parent::match($pathinfo);
|
||||
} catch (ResourceNotFoundException $e) {
|
||||
if ('/' === substr($pathinfo, -1) || !in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
try {
|
||||
parent::match($pathinfo.'/');
|
||||
|
||||
return $this->redirect($pathinfo.'/', null);
|
||||
} catch (ResourceNotFoundException $e2) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function handleRouteRequirements($pathinfo, $name, Route $route)
|
||||
{
|
||||
// expression condition
|
||||
if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) {
|
||||
return array(self::REQUIREMENT_MISMATCH, null);
|
||||
}
|
||||
|
||||
// check HTTP scheme requirement
|
||||
$scheme = $this->context->getScheme();
|
||||
$schemes = $route->getSchemes();
|
||||
if ($schemes && !$route->hasScheme($scheme)) {
|
||||
return array(self::ROUTE_MATCH, $this->redirect($pathinfo, $name, current($schemes)));
|
||||
}
|
||||
|
||||
return array(self::REQUIREMENT_MATCH, null);
|
||||
}
|
||||
}
|
31
Laravel/vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php
vendored
Normal file
31
Laravel/vendor/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher;
|
||||
|
||||
/**
|
||||
* RedirectableUrlMatcherInterface knows how to redirect the user.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface RedirectableUrlMatcherInterface
|
||||
{
|
||||
/**
|
||||
* Redirects the user to another URL.
|
||||
*
|
||||
* @param string $path The path info to redirect to
|
||||
* @param string $route The route name that matched
|
||||
* @param string|null $scheme The URL scheme (null to keep the current one)
|
||||
*
|
||||
* @return array An array of parameters
|
||||
*/
|
||||
public function redirect($path, $route, $scheme = null);
|
||||
}
|
39
Laravel/vendor/symfony/routing/Matcher/RequestMatcherInterface.php
vendored
Normal file
39
Laravel/vendor/symfony/routing/Matcher/RequestMatcherInterface.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
|
||||
/**
|
||||
* RequestMatcherInterface is the interface that all request matcher classes must implement.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface RequestMatcherInterface
|
||||
{
|
||||
/**
|
||||
* Tries to match a request with a set of routes.
|
||||
*
|
||||
* 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 ResourceNotFoundException If no matching resource could be found
|
||||
* @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed
|
||||
*/
|
||||
public function matchRequest(Request $request);
|
||||
}
|
141
Laravel/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php
vendored
Normal file
141
Laravel/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* TraceableUrlMatcher helps debug path info matching by tracing the match.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class TraceableUrlMatcher extends UrlMatcher
|
||||
{
|
||||
const ROUTE_DOES_NOT_MATCH = 0;
|
||||
const ROUTE_ALMOST_MATCHES = 1;
|
||||
const ROUTE_MATCHES = 2;
|
||||
|
||||
protected $traces;
|
||||
|
||||
public function getTraces($pathinfo)
|
||||
{
|
||||
$this->traces = array();
|
||||
|
||||
try {
|
||||
$this->match($pathinfo);
|
||||
} catch (ExceptionInterface $e) {
|
||||
}
|
||||
|
||||
return $this->traces;
|
||||
}
|
||||
|
||||
public function getTracesForRequest(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
$traces = $this->getTraces($request->getPathInfo());
|
||||
$this->request = null;
|
||||
|
||||
return $traces;
|
||||
}
|
||||
|
||||
protected function matchCollection($pathinfo, RouteCollection $routes)
|
||||
{
|
||||
foreach ($routes as $name => $route) {
|
||||
$compiledRoute = $route->compile();
|
||||
|
||||
if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) {
|
||||
// does it match without any requirements?
|
||||
$r = new Route($route->getPath(), $route->getDefaults(), array(), $route->getOptions());
|
||||
$cr = $r->compile();
|
||||
if (!preg_match($cr->getRegex(), $pathinfo)) {
|
||||
$this->addTrace(sprintf('Path "%s" does not match', $route->getPath()), self::ROUTE_DOES_NOT_MATCH, $name, $route);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($route->getRequirements() as $n => $regex) {
|
||||
$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)) {
|
||||
$this->addTrace(sprintf('Requirement for "%s" does not match (%s)', $n, $regex), self::ROUTE_ALMOST_MATCHES, $name, $route);
|
||||
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// check host requirement
|
||||
$hostMatches = array();
|
||||
if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) {
|
||||
$this->addTrace(sprintf('Host "%s" does not match the requirement ("%s")', $this->context->getHost(), $route->getHost()), self::ROUTE_ALMOST_MATCHES, $name, $route);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// check HTTP method requirement
|
||||
if ($requiredMethods = $route->getMethods()) {
|
||||
// HEAD and GET are equivalent as per RFC
|
||||
if ('HEAD' === $method = $this->context->getMethod()) {
|
||||
$method = 'GET';
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// check condition
|
||||
if ($condition = $route->getCondition()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// check HTTP scheme requirement
|
||||
if ($requiredSchemes = $route->getSchemes()) {
|
||||
$scheme = $this->context->getScheme();
|
||||
|
||||
if (!$route->hasScheme($scheme)) {
|
||||
$this->addTrace(sprintf('Scheme "%s" does not match any of the required schemes (%s); the user will be redirected to first required scheme', $scheme, implode(', ', $requiredSchemes)), self::ROUTE_ALMOST_MATCHES, $name, $route);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private function addTrace($log, $level = self::ROUTE_DOES_NOT_MATCH, $name = null, $route = null)
|
||||
{
|
||||
$this->traces[] = array(
|
||||
'log' => $log,
|
||||
'name' => $name,
|
||||
'level' => $level,
|
||||
'path' => null !== $route ? $route->getPath() : null,
|
||||
);
|
||||
}
|
||||
}
|
266
Laravel/vendor/symfony/routing/Matcher/UrlMatcher.php
vendored
Normal file
266
Laravel/vendor/symfony/routing/Matcher/UrlMatcher.php
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher;
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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;
|
||||
|
||||
/**
|
||||
* UrlMatcher matches URL based on a set of routes.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
|
||||
{
|
||||
const REQUIREMENT_MATCH = 0;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @var ExpressionFunctionProviderInterface[]
|
||||
*/
|
||||
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;
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContext(RequestContext $context)
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function match($pathinfo)
|
||||
{
|
||||
$this->allow = array();
|
||||
|
||||
if ($ret = $this->matchCollection(rawurldecode($pathinfo), $this->routes)) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
throw 0 < count($this->allow)
|
||||
? new MethodNotAllowedException(array_unique($this->allow))
|
||||
: new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function matchRequest(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
$ret = $this->match($request->getPathInfo());
|
||||
|
||||
$this->request = null;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
|
||||
{
|
||||
$this->expressionLanguageProviders[] = $provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to match a URL with a set of routes.
|
||||
*
|
||||
* @param string $pathinfo The path info to be parsed
|
||||
* @param RouteCollection $routes The set of routes
|
||||
*
|
||||
* @return array An array of parameters
|
||||
*
|
||||
* @throws ResourceNotFoundException If the resource could not be found
|
||||
* @throws MethodNotAllowedException If the resource was found but the request method is not allowed
|
||||
*/
|
||||
protected function matchCollection($pathinfo, RouteCollection $routes)
|
||||
{
|
||||
foreach ($routes as $name => $route) {
|
||||
$compiledRoute = $route->compile();
|
||||
|
||||
// check the static prefix of the URL first. Only use the more expensive preg_match when it matches
|
||||
if ('' !== $compiledRoute->getStaticPrefix() && 0 !== strpos($pathinfo, $compiledRoute->getStaticPrefix())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$hostMatches = array();
|
||||
if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check HTTP method requirement
|
||||
if ($requiredMethods = $route->getMethods()) {
|
||||
// HEAD and GET are equivalent as per RFC
|
||||
if ('HEAD' === $method = $this->context->getMethod()) {
|
||||
$method = 'GET';
|
||||
}
|
||||
|
||||
if (!in_array($method, $requiredMethods)) {
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of values to use as request attributes.
|
||||
*
|
||||
* As this method requires the Route object, it is not available
|
||||
* in matchers that do not have access to the matched Route instance
|
||||
* (like the PHP and Apache matcher dumpers).
|
||||
*
|
||||
* @param Route $route The route we are matching against
|
||||
* @param string $name The name of the route
|
||||
* @param array $attributes An array of attributes from the matcher
|
||||
*
|
||||
* @return array An array of parameters
|
||||
*/
|
||||
protected function getAttributes(Route $route, $name, array $attributes)
|
||||
{
|
||||
$attributes['_route'] = $name;
|
||||
|
||||
return $this->mergeDefaults($attributes, $route->getDefaults());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles specific route requirements.
|
||||
*
|
||||
* @param string $pathinfo The path
|
||||
* @param string $name The route name
|
||||
* @param Route $route The route
|
||||
*
|
||||
* @return array The first element represents the status, the second contains additional information
|
||||
*/
|
||||
protected function handleRouteRequirements($pathinfo, $name, Route $route)
|
||||
{
|
||||
// expression condition
|
||||
if ($route->getCondition() && !$this->getExpressionLanguage()->evaluate($route->getCondition(), array('context' => $this->context, 'request' => $this->request ?: $this->createRequest($pathinfo)))) {
|
||||
return array(self::REQUIREMENT_MISMATCH, null);
|
||||
}
|
||||
|
||||
// check HTTP scheme requirement
|
||||
$scheme = $this->context->getScheme();
|
||||
$status = $route->getSchemes() && !$route->hasScheme($scheme) ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH;
|
||||
|
||||
return array($status, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get merged default parameters.
|
||||
*
|
||||
* @param array $params The parameters
|
||||
* @param array $defaults The defaults
|
||||
*
|
||||
* @return array Merged default parameters
|
||||
*/
|
||||
protected function mergeDefaults($params, $defaults)
|
||||
{
|
||||
foreach ($params as $key => $value) {
|
||||
if (!is_int($key)) {
|
||||
$defaults[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
protected function getExpressionLanguage()
|
||||
{
|
||||
if (null === $this->expressionLanguage) {
|
||||
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
|
||||
throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
|
||||
}
|
||||
$this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
|
||||
}
|
||||
|
||||
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(),
|
||||
));
|
||||
}
|
||||
}
|
39
Laravel/vendor/symfony/routing/Matcher/UrlMatcherInterface.php
vendored
Normal file
39
Laravel/vendor/symfony/routing/Matcher/UrlMatcherInterface.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher;
|
||||
|
||||
use Symfony\Component\Routing\RequestContextAwareInterface;
|
||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
|
||||
/**
|
||||
* UrlMatcherInterface is the interface that all URL matcher classes must implement.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface UrlMatcherInterface extends RequestContextAwareInterface
|
||||
{
|
||||
/**
|
||||
* Tries to match a URL path with a set of routes.
|
||||
*
|
||||
* If the matcher can not find information, it must throw one of the exceptions documented
|
||||
* below.
|
||||
*
|
||||
* @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded)
|
||||
*
|
||||
* @return array An array of parameters
|
||||
*
|
||||
* @throws ResourceNotFoundException If the resource could not be found
|
||||
* @throws MethodNotAllowedException If the resource was found but the request method is not allowed
|
||||
*/
|
||||
public function match($pathinfo);
|
||||
}
|
13
Laravel/vendor/symfony/routing/README.md
vendored
Normal file
13
Laravel/vendor/symfony/routing/README.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Routing Component
|
||||
=================
|
||||
|
||||
The Routing component maps an HTTP request to a set of configuration variables.
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
* [Documentation](https://symfony.com/doc/current/components/routing/index.html)
|
||||
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
|
||||
* [Report issues](https://github.com/symfony/symfony/issues) and
|
||||
[send Pull Requests](https://github.com/symfony/symfony/pulls)
|
||||
in the [main Symfony repository](https://github.com/symfony/symfony)
|
344
Laravel/vendor/symfony/routing/RequestContext.php
vendored
Normal file
344
Laravel/vendor/symfony/routing/RequestContext.php
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Holds information about the current request.
|
||||
*
|
||||
* This class implements a fluent interface.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class RequestContext
|
||||
{
|
||||
private $baseUrl;
|
||||
private $pathInfo;
|
||||
private $method;
|
||||
private $host;
|
||||
private $scheme;
|
||||
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
|
||||
* @param string $scheme The HTTP scheme
|
||||
* @param int $httpPort The HTTP port
|
||||
* @param int $httpsPort The HTTPS port
|
||||
* @param string $path The path
|
||||
* @param string $queryString The query string
|
||||
*/
|
||||
public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443, $path = '/', $queryString = '')
|
||||
{
|
||||
$this->setBaseUrl($baseUrl);
|
||||
$this->setMethod($method);
|
||||
$this->setHost($host);
|
||||
$this->setScheme($scheme);
|
||||
$this->setHttpPort($httpPort);
|
||||
$this->setHttpsPort($httpsPort);
|
||||
$this->setPathInfo($path);
|
||||
$this->setQueryString($queryString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the RequestContext information based on a HttpFoundation Request.
|
||||
*
|
||||
* @param Request $request A Request instance
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function fromRequest(Request $request)
|
||||
{
|
||||
$this->setBaseUrl($request->getBaseUrl());
|
||||
$this->setPathInfo($request->getPathInfo());
|
||||
$this->setMethod($request->getMethod());
|
||||
$this->setHost($request->getHost());
|
||||
$this->setScheme($request->getScheme());
|
||||
$this->setHttpPort($request->isSecure() ? $this->httpPort : $request->getPort());
|
||||
$this->setHttpsPort($request->isSecure() ? $request->getPort() : $this->httpsPort);
|
||||
$this->setQueryString($request->server->get('QUERY_STRING', ''));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base URL.
|
||||
*
|
||||
* @return string The base URL
|
||||
*/
|
||||
public function getBaseUrl()
|
||||
{
|
||||
return $this->baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base URL.
|
||||
*
|
||||
* @param string $baseUrl The base URL
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBaseUrl($baseUrl)
|
||||
{
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path info.
|
||||
*
|
||||
* @return string The path info
|
||||
*/
|
||||
public function getPathInfo()
|
||||
{
|
||||
return $this->pathInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the path info.
|
||||
*
|
||||
* @param string $pathInfo The path info
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPathInfo($pathInfo)
|
||||
{
|
||||
$this->pathInfo = $pathInfo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP method.
|
||||
*
|
||||
* The method is always an uppercased string.
|
||||
*
|
||||
* @return string The HTTP method
|
||||
*/
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP method.
|
||||
*
|
||||
* @param string $method The HTTP method
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMethod($method)
|
||||
{
|
||||
$this->method = strtoupper($method);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP host.
|
||||
*
|
||||
* The host is always lowercased because it must be treated case-insensitive.
|
||||
*
|
||||
* @return string The HTTP host
|
||||
*/
|
||||
public function getHost()
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP host.
|
||||
*
|
||||
* @param string $host The HTTP host
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHost($host)
|
||||
{
|
||||
$this->host = strtolower($host);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP scheme.
|
||||
*
|
||||
* @return string The HTTP scheme
|
||||
*/
|
||||
public function getScheme()
|
||||
{
|
||||
return $this->scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP scheme.
|
||||
*
|
||||
* @param string $scheme The HTTP scheme
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setScheme($scheme)
|
||||
{
|
||||
$this->scheme = strtolower($scheme);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP port.
|
||||
*
|
||||
* @return int The HTTP port
|
||||
*/
|
||||
public function getHttpPort()
|
||||
{
|
||||
return $this->httpPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP port.
|
||||
*
|
||||
* @param int $httpPort The HTTP port
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHttpPort($httpPort)
|
||||
{
|
||||
$this->httpPort = (int) $httpPort;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTPS port.
|
||||
*
|
||||
* @return int The HTTPS port
|
||||
*/
|
||||
public function getHttpsPort()
|
||||
{
|
||||
return $this->httpsPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTPS port.
|
||||
*
|
||||
* @param int $httpsPort The HTTPS port
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHttpsPort($httpsPort)
|
||||
{
|
||||
$this->httpsPort = (int) $httpsPort;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the query string.
|
||||
*
|
||||
* @return string The query string without the "?"
|
||||
*/
|
||||
public function getQueryString()
|
||||
{
|
||||
return $this->queryString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the query string.
|
||||
*
|
||||
* @param string $queryString The query string (after "?")
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setQueryString($queryString)
|
||||
{
|
||||
// string cast to be fault-tolerant, accepting null
|
||||
$this->queryString = (string) $queryString;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parameters.
|
||||
*
|
||||
* @return array The parameters
|
||||
*/
|
||||
public function getParameters()
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parameters.
|
||||
*
|
||||
* @param array $parameters The parameters
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParameters(array $parameters)
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a parameter value.
|
||||
*
|
||||
* @param string $name A parameter name
|
||||
*
|
||||
* @return mixed The parameter value or null if nonexistent
|
||||
*/
|
||||
public function getParameter($name)
|
||||
{
|
||||
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a parameter value is set for the given parameter.
|
||||
*
|
||||
* @param string $name A parameter name
|
||||
*
|
||||
* @return bool True if the parameter value is set, false otherwise
|
||||
*/
|
||||
public function hasParameter($name)
|
||||
{
|
||||
return array_key_exists($name, $this->parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter value.
|
||||
*
|
||||
* @param string $name A parameter name
|
||||
* @param mixed $parameter The parameter value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParameter($name, $parameter)
|
||||
{
|
||||
$this->parameters[$name] = $parameter;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
29
Laravel/vendor/symfony/routing/RequestContextAwareInterface.php
vendored
Normal file
29
Laravel/vendor/symfony/routing/RequestContextAwareInterface.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
interface RequestContextAwareInterface
|
||||
{
|
||||
/**
|
||||
* Sets the request context.
|
||||
*
|
||||
* @param RequestContext $context The context
|
||||
*/
|
||||
public function setContext(RequestContext $context);
|
||||
|
||||
/**
|
||||
* Gets the request context.
|
||||
*
|
||||
* @return RequestContext The context
|
||||
*/
|
||||
public function getContext();
|
||||
}
|
589
Laravel/vendor/symfony/routing/Route.php
vendored
Normal file
589
Laravel/vendor/symfony/routing/Route.php
vendored
Normal file
@@ -0,0 +1,589 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
/**
|
||||
* A Route describes a route and its parameters.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* @var null|CompiledRoute
|
||||
*/
|
||||
private $compiled;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $condition = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Available options:
|
||||
*
|
||||
* * 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
|
||||
*/
|
||||
public function __construct($path, array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array(), $condition = '')
|
||||
{
|
||||
$this->setPath($path);
|
||||
$this->setDefaults($defaults);
|
||||
$this->setRequirements($requirements);
|
||||
$this->setOptions($options);
|
||||
$this->setHost($host);
|
||||
$this->setSchemes($schemes);
|
||||
$this->setMethods($methods);
|
||||
$this->setCondition($condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(array(
|
||||
'path' => $this->path,
|
||||
'host' => $this->host,
|
||||
'defaults' => $this->defaults,
|
||||
'requirements' => $this->requirements,
|
||||
'options' => $this->options,
|
||||
'schemes' => $this->schemes,
|
||||
'methods' => $this->methods,
|
||||
'condition' => $this->condition,
|
||||
'compiled' => $this->compiled,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$data = unserialize($serialized);
|
||||
$this->path = $data['path'];
|
||||
$this->host = $data['host'];
|
||||
$this->defaults = $data['defaults'];
|
||||
$this->requirements = $data['requirements'];
|
||||
$this->options = $data['options'];
|
||||
$this->schemes = $data['schemes'];
|
||||
$this->methods = $data['methods'];
|
||||
|
||||
if (isset($data['condition'])) {
|
||||
$this->condition = $data['condition'];
|
||||
}
|
||||
if (isset($data['compiled'])) {
|
||||
$this->compiled = $data['compiled'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pattern for the path.
|
||||
*
|
||||
* @return string The path pattern
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pattern for the path.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param string $pattern The path pattern
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPath($pattern)
|
||||
{
|
||||
// A pattern must start with a slash and must not have multiple slashes at the beginning because the
|
||||
// generated path for this route would be confused with a network path, e.g. '//domain.com/path'.
|
||||
$this->path = '/'.ltrim(trim($pattern), '/');
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pattern for the host.
|
||||
*
|
||||
* @return string The host pattern
|
||||
*/
|
||||
public function getHost()
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pattern for the host.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param string $pattern The host pattern
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHost($pattern)
|
||||
{
|
||||
$this->host = (string) $pattern;
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the lowercased schemes this route is restricted to.
|
||||
* So an empty array means that any scheme is allowed.
|
||||
*
|
||||
* @return array The schemes
|
||||
*/
|
||||
public function getSchemes()
|
||||
{
|
||||
return $this->schemes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the schemes (e.g. 'https') this route is restricted to.
|
||||
* So an empty array means that any scheme is allowed.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param string|array $schemes The scheme or an array of schemes
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSchemes($schemes)
|
||||
{
|
||||
$this->schemes = array_map('strtolower', (array) $schemes);
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a scheme requirement has been set.
|
||||
*
|
||||
* @param string $scheme
|
||||
*
|
||||
* @return bool true if the scheme requirement exists, otherwise false
|
||||
*/
|
||||
public function hasScheme($scheme)
|
||||
{
|
||||
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
|
||||
*/
|
||||
public function getMethods()
|
||||
{
|
||||
return $this->methods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP methods (e.g. 'POST') this route is restricted to.
|
||||
* So an empty array means that any method is allowed.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param string|array $methods The method or an array of methods
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMethods($methods)
|
||||
{
|
||||
$this->methods = array_map('strtoupper', (array) $methods);
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the options.
|
||||
*
|
||||
* @return array The options
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the options.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param array $options The options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
{
|
||||
$this->options = array(
|
||||
'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler',
|
||||
);
|
||||
|
||||
return $this->addOptions($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds options.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param array $options The options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addOptions(array $options)
|
||||
{
|
||||
foreach ($options as $name => $option) {
|
||||
$this->options[$name] = $option;
|
||||
}
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an option value.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param string $name An option name
|
||||
* @param mixed $value The option value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
$this->options[$name] = $value;
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an option value.
|
||||
*
|
||||
* @param string $name An option name
|
||||
*
|
||||
* @return mixed The option value or null when not given
|
||||
*/
|
||||
public function getOption($name)
|
||||
{
|
||||
return isset($this->options[$name]) ? $this->options[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an option has been set.
|
||||
*
|
||||
* @param string $name An option name
|
||||
*
|
||||
* @return bool true if the option is set, false otherwise
|
||||
*/
|
||||
public function hasOption($name)
|
||||
{
|
||||
return array_key_exists($name, $this->options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the defaults.
|
||||
*
|
||||
* @return array The defaults
|
||||
*/
|
||||
public function getDefaults()
|
||||
{
|
||||
return $this->defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the defaults.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param array $defaults The defaults
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDefaults(array $defaults)
|
||||
{
|
||||
$this->defaults = array();
|
||||
|
||||
return $this->addDefaults($defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds defaults.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param array $defaults The defaults
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addDefaults(array $defaults)
|
||||
{
|
||||
foreach ($defaults as $name => $default) {
|
||||
$this->defaults[$name] = $default;
|
||||
}
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a default value.
|
||||
*
|
||||
* @param string $name A variable name
|
||||
*
|
||||
* @return mixed The default value or null when not given
|
||||
*/
|
||||
public function getDefault($name)
|
||||
{
|
||||
return isset($this->defaults[$name]) ? $this->defaults[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a default value is set for the given variable.
|
||||
*
|
||||
* @param string $name A variable name
|
||||
*
|
||||
* @return bool true if the default value is set, false otherwise
|
||||
*/
|
||||
public function hasDefault($name)
|
||||
{
|
||||
return array_key_exists($name, $this->defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a default value.
|
||||
*
|
||||
* @param string $name A variable name
|
||||
* @param mixed $default The default value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDefault($name, $default)
|
||||
{
|
||||
$this->defaults[$name] = $default;
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requirements.
|
||||
*
|
||||
* @return array The requirements
|
||||
*/
|
||||
public function getRequirements()
|
||||
{
|
||||
return $this->requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the requirements.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param array $requirements The requirements
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequirements(array $requirements)
|
||||
{
|
||||
$this->requirements = array();
|
||||
|
||||
return $this->addRequirements($requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds requirements.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param array $requirements The requirements
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addRequirements(array $requirements)
|
||||
{
|
||||
foreach ($requirements as $key => $regex) {
|
||||
$this->requirements[$key] = $this->sanitizeRequirement($key, $regex);
|
||||
}
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the requirement for the given key.
|
||||
*
|
||||
* @param string $key The key
|
||||
*
|
||||
* @return string|null The regex or null when not given
|
||||
*/
|
||||
public function getRequirement($key)
|
||||
{
|
||||
return isset($this->requirements[$key]) ? $this->requirements[$key] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a requirement is set for the given key.
|
||||
*
|
||||
* @param string $key A variable name
|
||||
*
|
||||
* @return bool true if a requirement is specified, false otherwise
|
||||
*/
|
||||
public function hasRequirement($key)
|
||||
{
|
||||
return array_key_exists($key, $this->requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a requirement for the given key.
|
||||
*
|
||||
* @param string $key The key
|
||||
* @param string $regex The regex
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequirement($key, $regex)
|
||||
{
|
||||
$this->requirements[$key] = $this->sanitizeRequirement($key, $regex);
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the condition.
|
||||
*
|
||||
* @return string The condition
|
||||
*/
|
||||
public function getCondition()
|
||||
{
|
||||
return $this->condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the condition.
|
||||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param string $condition The condition
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCondition($condition)
|
||||
{
|
||||
$this->condition = (string) $condition;
|
||||
$this->compiled = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles the route.
|
||||
*
|
||||
* @return CompiledRoute A CompiledRoute instance
|
||||
*
|
||||
* @throws \LogicException If the Route cannot be compiled because the
|
||||
* path or host pattern is invalid
|
||||
*
|
||||
* @see RouteCompiler which is responsible for the compilation process
|
||||
*/
|
||||
public function compile()
|
||||
{
|
||||
if (null !== $this->compiled) {
|
||||
return $this->compiled;
|
||||
}
|
||||
|
||||
$class = $this->getOption('compiler_class');
|
||||
|
||||
return $this->compiled = $class::compile($this);
|
||||
}
|
||||
|
||||
private function sanitizeRequirement($key, $regex)
|
||||
{
|
||||
if (!is_string($regex)) {
|
||||
throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string.', $key));
|
||||
}
|
||||
|
||||
if ('' !== $regex && '^' === $regex[0]) {
|
||||
$regex = (string) substr($regex, 1); // returns false for a single character
|
||||
}
|
||||
|
||||
if ('$' === substr($regex, -1)) {
|
||||
$regex = substr($regex, 0, -1);
|
||||
}
|
||||
|
||||
if ('' === $regex) {
|
||||
throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" cannot be empty.', $key));
|
||||
}
|
||||
|
||||
return $regex;
|
||||
}
|
||||
}
|
277
Laravel/vendor/symfony/routing/RouteCollection.php
vendored
Normal file
277
Laravel/vendor/symfony/routing/RouteCollection.php
vendored
Normal file
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
||||
|
||||
/**
|
||||
* A RouteCollection represents a set of Route instances.
|
||||
*
|
||||
* When adding a route at the end of the collection, an existing route
|
||||
* with the same name is removed first. So there can only be one route
|
||||
* with a given name.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class RouteCollection implements \IteratorAggregate, \Countable
|
||||
{
|
||||
/**
|
||||
* @var Route[]
|
||||
*/
|
||||
private $routes = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $resources = array();
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
foreach ($this->routes as $name => $route) {
|
||||
$this->routes[$name] = clone $route;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current RouteCollection as an Iterator that includes all routes.
|
||||
*
|
||||
* It implements \IteratorAggregate.
|
||||
*
|
||||
* @see all()
|
||||
*
|
||||
* @return \ArrayIterator|Route[] An \ArrayIterator object for iterating over routes
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->routes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of Routes in this collection.
|
||||
*
|
||||
* @return int The number of routes
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->routes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a route.
|
||||
*
|
||||
* @param string $name The route name
|
||||
* @param Route $route A Route instance
|
||||
*/
|
||||
public function add($name, Route $route)
|
||||
{
|
||||
unset($this->routes[$name]);
|
||||
|
||||
$this->routes[$name] = $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all routes in this collection.
|
||||
*
|
||||
* @return Route[] An array of routes
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->routes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a route by name.
|
||||
*
|
||||
* @param string $name The route name
|
||||
*
|
||||
* @return Route|null A Route instance or null when not found
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
return isset($this->routes[$name]) ? $this->routes[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public function remove($name)
|
||||
{
|
||||
foreach ((array) $name as $n) {
|
||||
unset($this->routes[$n]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// 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
|
||||
foreach ($collection->all() as $name => $route) {
|
||||
unset($this->routes[$name]);
|
||||
$this->routes[$name] = $route;
|
||||
}
|
||||
|
||||
$this->resources = array_merge($this->resources, $collection->getResources());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a prefix to the path of all child routes.
|
||||
*
|
||||
* @param string $prefix An optional prefix to add before each pattern of the route collection
|
||||
* @param array $defaults An array of default values
|
||||
* @param array $requirements An array of requirements
|
||||
*/
|
||||
public function addPrefix($prefix, array $defaults = array(), array $requirements = array())
|
||||
{
|
||||
$prefix = trim(trim($prefix), '/');
|
||||
|
||||
if ('' === $prefix) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->routes as $route) {
|
||||
$route->setPath('/'.$prefix.$route->getPath());
|
||||
$route->addDefaults($defaults);
|
||||
$route->addRequirements($requirements);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the host pattern on all routes.
|
||||
*
|
||||
* @param string $pattern The pattern
|
||||
* @param array $defaults An array of default values
|
||||
* @param array $requirements An array of requirements
|
||||
*/
|
||||
public function setHost($pattern, array $defaults = array(), array $requirements = array())
|
||||
{
|
||||
foreach ($this->routes as $route) {
|
||||
$route->setHost($pattern);
|
||||
$route->addDefaults($defaults);
|
||||
$route->addRequirements($requirements);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a condition on all routes.
|
||||
*
|
||||
* Existing conditions will be overridden.
|
||||
*
|
||||
* @param string $condition The condition
|
||||
*/
|
||||
public function setCondition($condition)
|
||||
{
|
||||
foreach ($this->routes as $route) {
|
||||
$route->setCondition($condition);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds defaults to all routes.
|
||||
*
|
||||
* An existing default value under the same name in a route will be overridden.
|
||||
*
|
||||
* @param array $defaults An array of default values
|
||||
*/
|
||||
public function addDefaults(array $defaults)
|
||||
{
|
||||
if ($defaults) {
|
||||
foreach ($this->routes as $route) {
|
||||
$route->addDefaults($defaults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds requirements to all routes.
|
||||
*
|
||||
* An existing requirement under the same name in a route will be overridden.
|
||||
*
|
||||
* @param array $requirements An array of requirements
|
||||
*/
|
||||
public function addRequirements(array $requirements)
|
||||
{
|
||||
if ($requirements) {
|
||||
foreach ($this->routes as $route) {
|
||||
$route->addRequirements($requirements);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds options to all routes.
|
||||
*
|
||||
* An existing option value under the same name in a route will be overridden.
|
||||
*
|
||||
* @param array $options An array of options
|
||||
*/
|
||||
public function addOptions(array $options)
|
||||
{
|
||||
if ($options) {
|
||||
foreach ($this->routes as $route) {
|
||||
$route->addOptions($options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the schemes (e.g. 'https') all child routes are restricted to.
|
||||
*
|
||||
* @param string|array $schemes The scheme or an array of schemes
|
||||
*/
|
||||
public function setSchemes($schemes)
|
||||
{
|
||||
foreach ($this->routes as $route) {
|
||||
$route->setSchemes($schemes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP methods (e.g. 'POST') all child routes are restricted to.
|
||||
*
|
||||
* @param string|array $methods The method or an array of methods
|
||||
*/
|
||||
public function setMethods($methods)
|
||||
{
|
||||
foreach ($this->routes as $route) {
|
||||
$route->setMethods($methods);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of resources loaded to build this collection.
|
||||
*
|
||||
* @return ResourceInterface[] An array of resources
|
||||
*/
|
||||
public function getResources()
|
||||
{
|
||||
return array_unique($this->resources);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a resource for this collection.
|
||||
*
|
||||
* @param ResourceInterface $resource A resource instance
|
||||
*/
|
||||
public function addResource(ResourceInterface $resource)
|
||||
{
|
||||
$this->resources[] = $resource;
|
||||
}
|
||||
}
|
383
Laravel/vendor/symfony/routing/RouteCollectionBuilder.php
vendored
Normal file
383
Laravel/vendor/symfony/routing/RouteCollectionBuilder.php
vendored
Normal file
@@ -0,0 +1,383 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
use Symfony\Component\Config\Exception\FileLoaderLoadException;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
||||
|
||||
/**
|
||||
* Helps add and import routes into a RouteCollection.
|
||||
*
|
||||
* @author Ryan Weaver <ryan@knpuniversity.com>
|
||||
*/
|
||||
class RouteCollectionBuilder
|
||||
{
|
||||
/**
|
||||
* @var Route[]|RouteCollectionBuilder[]
|
||||
*/
|
||||
private $routes = array();
|
||||
|
||||
private $loader;
|
||||
private $defaults = array();
|
||||
private $prefix;
|
||||
private $host;
|
||||
private $condition;
|
||||
private $requirements = array();
|
||||
private $options = array();
|
||||
private $schemes;
|
||||
private $methods;
|
||||
private $resources = array();
|
||||
|
||||
/**
|
||||
* @param LoaderInterface $loader
|
||||
*/
|
||||
public function __construct(LoaderInterface $loader = null)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import an external routing resource and returns the RouteCollectionBuilder.
|
||||
*
|
||||
* $routes->import('blog.yml', '/blog');
|
||||
*
|
||||
* @param mixed $resource
|
||||
* @param string|null $prefix
|
||||
* @param string $type
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @throws FileLoaderLoadException
|
||||
*/
|
||||
public function import($resource, $prefix = '/', $type = null)
|
||||
{
|
||||
/** @var RouteCollection[] $collection */
|
||||
$collections = $this->load($resource, $type);
|
||||
|
||||
// create a builder from the RouteCollection
|
||||
$builder = $this->createBuilder();
|
||||
|
||||
foreach ($collections as $collection) {
|
||||
if (null === $collection) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($collection->all() as $name => $route) {
|
||||
$builder->addRoute($route, $name);
|
||||
}
|
||||
|
||||
foreach ($collection->getResources() as $resource) {
|
||||
$builder->addResource($resource);
|
||||
}
|
||||
|
||||
// mount into this builder
|
||||
$this->mount($prefix, $builder);
|
||||
}
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a route and returns it for future modification.
|
||||
*
|
||||
* @param string $path The route path
|
||||
* @param string $controller The route's controller
|
||||
* @param string|null $name The name to give this route
|
||||
*
|
||||
* @return Route
|
||||
*/
|
||||
public function add($path, $controller, $name = null)
|
||||
{
|
||||
$route = new Route($path);
|
||||
$route->setDefault('_controller', $controller);
|
||||
$this->addRoute($route, $name);
|
||||
|
||||
return $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a RouteCollectionBuilder that can be configured and then added with mount().
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function createBuilder()
|
||||
{
|
||||
return new self($this->loader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a RouteCollectionBuilder.
|
||||
*
|
||||
* @param string $prefix
|
||||
* @param RouteCollectionBuilder $builder
|
||||
*/
|
||||
public function mount($prefix, RouteCollectionBuilder $builder)
|
||||
{
|
||||
$builder->prefix = trim(trim($prefix), '/');
|
||||
$this->routes[] = $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Route object to the builder.
|
||||
*
|
||||
* @param Route $route
|
||||
* @param string|null $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addRoute(Route $route, $name = null)
|
||||
{
|
||||
if (null === $name) {
|
||||
// used as a flag to know which routes will need a name later
|
||||
$name = '_unnamed_route_'.spl_object_hash($route);
|
||||
}
|
||||
|
||||
$this->routes[$name] = $route;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the host on all embedded routes (unless already set).
|
||||
*
|
||||
* @param string $pattern
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHost($pattern)
|
||||
{
|
||||
$this->host = $pattern;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a condition on all embedded routes (unless already set).
|
||||
*
|
||||
* @param string $condition
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCondition($condition)
|
||||
{
|
||||
$this->condition = $condition;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a default value that will be added to all embedded routes (unless that
|
||||
* default value is already set).
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDefault($key, $value)
|
||||
{
|
||||
$this->defaults[$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a requirement that will be added to all embedded routes (unless that
|
||||
* requirement is already set).
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $regex
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequirement($key, $regex)
|
||||
{
|
||||
$this->requirements[$key] = $regex;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an option that will be added to all embedded routes (unless that
|
||||
* option is already set).
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOption($key, $value)
|
||||
{
|
||||
$this->options[$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the schemes on all embedded routes (unless already set).
|
||||
*
|
||||
* @param array|string $schemes
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSchemes($schemes)
|
||||
{
|
||||
$this->schemes = $schemes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the methods on all embedded routes (unless already set).
|
||||
*
|
||||
* @param array|string $methods
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMethods($methods)
|
||||
{
|
||||
$this->methods = $methods;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a resource for this collection.
|
||||
*
|
||||
* @param ResourceInterface $resource
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
private function addResource(ResourceInterface $resource)
|
||||
{
|
||||
$this->resources[] = $resource;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the final RouteCollection and returns it.
|
||||
*
|
||||
* @return RouteCollection
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$routeCollection = new RouteCollection();
|
||||
|
||||
foreach ($this->routes as $name => $route) {
|
||||
if ($route instanceof Route) {
|
||||
$route->setDefaults(array_merge($this->defaults, $route->getDefaults()));
|
||||
$route->setOptions(array_merge($this->options, $route->getOptions()));
|
||||
|
||||
foreach ($this->requirements as $key => $val) {
|
||||
if (!$route->hasRequirement($key)) {
|
||||
$route->setRequirement($key, $val);
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $this->prefix) {
|
||||
$route->setPath('/'.$this->prefix.$route->getPath());
|
||||
}
|
||||
|
||||
if (!$route->getHost()) {
|
||||
$route->setHost($this->host);
|
||||
}
|
||||
|
||||
if (!$route->getCondition()) {
|
||||
$route->setCondition($this->condition);
|
||||
}
|
||||
|
||||
if (!$route->getSchemes()) {
|
||||
$route->setSchemes($this->schemes);
|
||||
}
|
||||
|
||||
if (!$route->getMethods()) {
|
||||
$route->setMethods($this->methods);
|
||||
}
|
||||
|
||||
// auto-generate the route name if it's been marked
|
||||
if ('_unnamed_route_' === substr($name, 0, 15)) {
|
||||
$name = $this->generateRouteName($route);
|
||||
}
|
||||
|
||||
$routeCollection->add($name, $route);
|
||||
} else {
|
||||
/* @var self $route */
|
||||
$subCollection = $route->build();
|
||||
$subCollection->addPrefix($this->prefix);
|
||||
|
||||
$routeCollection->addCollection($subCollection);
|
||||
}
|
||||
|
||||
foreach ($this->resources as $resource) {
|
||||
$routeCollection->addResource($resource);
|
||||
}
|
||||
}
|
||||
|
||||
return $routeCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a route name based on details of this route.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateRouteName(Route $route)
|
||||
{
|
||||
$methods = implode('_', $route->getMethods()).'_';
|
||||
|
||||
$routeName = $methods.$route->getPath();
|
||||
$routeName = str_replace(array('/', ':', '|', '-'), '_', $routeName);
|
||||
$routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName);
|
||||
|
||||
// Collapse consecutive underscores down into a single underscore.
|
||||
$routeName = preg_replace('/_+/', '_', $routeName);
|
||||
|
||||
return $routeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a loader able to load an imported resource and loads it.
|
||||
*
|
||||
* @param mixed $resource A resource
|
||||
* @param string|null $type The resource type or null if unknown
|
||||
*
|
||||
* @return RouteCollection[]
|
||||
*
|
||||
* @throws FileLoaderLoadException If no loader is found
|
||||
*/
|
||||
private function load($resource, $type = null)
|
||||
{
|
||||
if (null === $this->loader) {
|
||||
throw new \BadMethodCallException('Cannot import other routing resources: you must pass a LoaderInterface when constructing RouteCollectionBuilder.');
|
||||
}
|
||||
|
||||
if ($this->loader->supports($resource, $type)) {
|
||||
$collections = $this->loader->load($resource, $type);
|
||||
|
||||
return is_array($collections) ? $collections : array($collections);
|
||||
}
|
||||
|
||||
if (null === $resolver = $this->loader->getResolver()) {
|
||||
throw new FileLoaderLoadException($resource, null, null, null, $type);
|
||||
}
|
||||
|
||||
if (false === $loader = $resolver->resolve($resource, $type)) {
|
||||
throw new FileLoaderLoadException($resource, null, null, null, $type);
|
||||
}
|
||||
|
||||
$collections = $loader->load($resource, $type);
|
||||
|
||||
return is_array($collections) ? $collections : array($collections);
|
||||
}
|
||||
}
|
319
Laravel/vendor/symfony/routing/RouteCompiler.php
vendored
Normal file
319
Laravel/vendor/symfony/routing/RouteCompiler.php
vendored
Normal file
@@ -0,0 +1,319 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
/**
|
||||
* RouteCompiler compiles Route instances to CompiledRoute instances.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class RouteCompiler implements RouteCompilerInterface
|
||||
{
|
||||
const REGEX_DELIMITER = '#';
|
||||
|
||||
/**
|
||||
* This string defines the characters that are automatically considered separators in front of
|
||||
* optional placeholders (with default and no static text following). Such a single separator
|
||||
* can be left out together with the optional placeholder from matching and generating URLs.
|
||||
*/
|
||||
const SEPARATORS = '/,;.:-_~+*=@|';
|
||||
|
||||
/**
|
||||
* The maximum supported length of a PCRE subpattern name
|
||||
* http://pcre.org/current/doc/html/pcre2pattern.html#SEC16.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const VARIABLE_MAXIMUM_LENGTH = 32;
|
||||
|
||||
/**
|
||||
* {@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.
|
||||
*/
|
||||
public static function compile(Route $route)
|
||||
{
|
||||
$hostVariables = array();
|
||||
$variables = array();
|
||||
$hostRegex = null;
|
||||
$hostTokens = array();
|
||||
|
||||
if ('' !== $host = $route->getHost()) {
|
||||
$result = self::compilePattern($route, $host, true);
|
||||
|
||||
$hostVariables = $result['variables'];
|
||||
$variables = $hostVariables;
|
||||
|
||||
$hostTokens = $result['tokens'];
|
||||
$hostRegex = $result['regex'];
|
||||
}
|
||||
|
||||
$path = $route->getPath();
|
||||
|
||||
$result = self::compilePattern($route, $path, false);
|
||||
|
||||
$staticPrefix = $result['staticPrefix'];
|
||||
|
||||
$pathVariables = $result['variables'];
|
||||
|
||||
foreach ($pathVariables as $pathParam) {
|
||||
if ('_fragment' === $pathParam) {
|
||||
throw new \InvalidArgumentException(sprintf('Route pattern "%s" cannot contain "_fragment" as a path parameter.', $route->getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
$variables = array_merge($variables, $pathVariables);
|
||||
|
||||
$tokens = $result['tokens'];
|
||||
$regex = $result['regex'];
|
||||
|
||||
return new CompiledRoute(
|
||||
$staticPrefix,
|
||||
$regex,
|
||||
$tokens,
|
||||
$pathVariables,
|
||||
$hostRegex,
|
||||
$hostTokens,
|
||||
$hostVariables,
|
||||
array_unique($variables)
|
||||
);
|
||||
}
|
||||
|
||||
private static function compilePattern(Route $route, $pattern, $isHost)
|
||||
{
|
||||
$tokens = array();
|
||||
$variables = array();
|
||||
$matches = array();
|
||||
$pos = 0;
|
||||
$defaultSeparator = $isHost ? '.' : '/';
|
||||
$useUtf8 = preg_match('//u', $pattern);
|
||||
$needsUtf8 = $route->getOption('utf8');
|
||||
|
||||
if (!$needsUtf8 && $useUtf8 && preg_match('/[\x80-\xFF]/', $pattern)) {
|
||||
$needsUtf8 = true;
|
||||
@trigger_error(sprintf('Using UTF-8 route patterns without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for pattern "%s".', $pattern), E_USER_DEPRECATED);
|
||||
}
|
||||
if (!$useUtf8 && $needsUtf8) {
|
||||
throw new \LogicException(sprintf('Cannot mix UTF-8 requirements with non-UTF-8 pattern "%s".', $pattern));
|
||||
}
|
||||
|
||||
// Match all variables enclosed in "{}" and iterate over them. But we only want to match the innermost variable
|
||||
// in case of nested "{}", e.g. {foo{bar}}. This in ensured because \w does not match "{" or "}" itself.
|
||||
preg_match_all('#\{\w+\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
|
||||
foreach ($matches as $match) {
|
||||
$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]);
|
||||
|
||||
if (!strlen($precedingText)) {
|
||||
$precedingChar = '';
|
||||
} elseif ($useUtf8) {
|
||||
preg_match('/.$/u', $precedingText, $precedingChar);
|
||||
$precedingChar = $precedingChar[0];
|
||||
} else {
|
||||
$precedingChar = substr($precedingText, -1);
|
||||
}
|
||||
$isSeparator = '' !== $precedingChar && false !== strpos(static::SEPARATORS, $precedingChar);
|
||||
|
||||
// A PCRE subpattern name must start with a non-digit. Also a PHP variable cannot start with a digit so the
|
||||
// variable would not be usable as a Controller action argument.
|
||||
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)) {
|
||||
throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $pattern, $varName));
|
||||
}
|
||||
|
||||
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', $precedingText);
|
||||
}
|
||||
|
||||
$regexp = $route->getRequirement($varName);
|
||||
if (null === $regexp) {
|
||||
$followingPattern = (string) substr($pattern, $pos);
|
||||
// Find the next static character after the variable that functions as a separator. By default, this separator and '/'
|
||||
// are disallowed for the variable. This default requirement makes sure that optional variables can be matched at all
|
||||
// and that the generating-matching-combination of URLs unambiguous, i.e. the params used for generating the URL are
|
||||
// the same that will be matched. Example: new Route('/{page}.{_format}', array('_format' => 'html'))
|
||||
// If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything.
|
||||
// Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally
|
||||
// part of {_format} when generating the URL, e.g. _format = 'mobile.html'.
|
||||
$nextSeparator = self::findNextSeparator($followingPattern, $useUtf8);
|
||||
$regexp = sprintf(
|
||||
'[^%s%s]+',
|
||||
preg_quote($defaultSeparator, self::REGEX_DELIMITER),
|
||||
$defaultSeparator !== $nextSeparator && '' !== $nextSeparator ? preg_quote($nextSeparator, self::REGEX_DELIMITER) : ''
|
||||
);
|
||||
if (('' !== $nextSeparator && !preg_match('#^\{\w+\}#', $followingPattern)) || '' === $followingPattern) {
|
||||
// When we have a separator, which is disallowed for the variable, we can optimize the regex with a possessive
|
||||
// quantifier. This prevents useless backtracking of PCRE and improves performance by 20% for matching those patterns.
|
||||
// Given the above example, there is no point in backtracking into {page} (that forbids the dot) when a dot must follow
|
||||
// after it. This optimization cannot be applied when the next char is no real separator or when the next variable is
|
||||
// directly adjacent, e.g. '/{x}{y}'.
|
||||
$regexp .= '+';
|
||||
}
|
||||
} else {
|
||||
if (!preg_match('//u', $regexp)) {
|
||||
$useUtf8 = false;
|
||||
} elseif (!$needsUtf8 && preg_match('/[\x80-\xFF]|(?<!\\\\)\\\\(?:\\\\\\\\)*+(?-i:X|[pP][\{CLMNPSZ]|x\{[A-Fa-f0-9]{3})/', $regexp)) {
|
||||
$needsUtf8 = true;
|
||||
@trigger_error(sprintf('Using UTF-8 route requirements without setting the "utf8" option is deprecated since Symfony 3.2 and will throw a LogicException in 4.0. Turn on the "utf8" route option for variable "%s" in pattern "%s".', $varName, $pattern), E_USER_DEPRECATED);
|
||||
}
|
||||
if (!$useUtf8 && $needsUtf8) {
|
||||
throw new \LogicException(sprintf('Cannot mix UTF-8 requirement with non-UTF-8 charset for variable "%s" in pattern "%s".', $varName, $pattern));
|
||||
}
|
||||
}
|
||||
|
||||
$tokens[] = array('variable', $isSeparator ? $precedingChar : '', $regexp, $varName);
|
||||
$variables[] = $varName;
|
||||
}
|
||||
|
||||
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) {
|
||||
$token = $tokens[$i];
|
||||
if ('variable' === $token[0] && $route->hasDefault($token[3])) {
|
||||
$firstOptional = $i;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// compute the matching regexp
|
||||
$regexp = '';
|
||||
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' : '');
|
||||
|
||||
// enable Utf8 matching if really required
|
||||
if ($needsUtf8) {
|
||||
$regexp .= 'u';
|
||||
for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) {
|
||||
if ('variable' === $tokens[$i][0]) {
|
||||
$tokens[$i][] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'staticPrefix' => self::determineStaticPrefix($route, $tokens),
|
||||
'regex' => $regexp,
|
||||
'tokens' => array_reverse($tokens),
|
||||
'variables' => $variables,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
if ('text' !== $tokens[0][0]) {
|
||||
return ($route->hasDefault($tokens[0][3]) || '/' === $tokens[0][1]) ? '' : $tokens[0][1];
|
||||
}
|
||||
|
||||
$prefix = $tokens[0][1];
|
||||
|
||||
if (isset($tokens[1][1]) && '/' !== $tokens[1][1] && false === $route->hasDefault($tokens[1][3])) {
|
||||
$prefix .= $tokens[1][1];
|
||||
}
|
||||
|
||||
return $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next static character in the Route pattern that will serve as a separator.
|
||||
*
|
||||
* @param string $pattern The route pattern
|
||||
* @param bool $useUtf8 Whether the character is encoded in UTF-8 or not
|
||||
*
|
||||
* @return string The next static character that functions as separator (or empty string when none available)
|
||||
*/
|
||||
private static function findNextSeparator($pattern, $useUtf8)
|
||||
{
|
||||
if ('' == $pattern) {
|
||||
// return empty string if pattern is empty or false (false which can be returned by substr)
|
||||
return '';
|
||||
}
|
||||
// first remove all placeholders from the pattern so we can find the next real static character
|
||||
if ('' === $pattern = preg_replace('#\{\w+\}#', '', $pattern)) {
|
||||
return '';
|
||||
}
|
||||
if ($useUtf8) {
|
||||
preg_match('/^./u', $pattern, $pattern);
|
||||
}
|
||||
|
||||
return false !== strpos(static::SEPARATORS, $pattern[0]) ? $pattern[0] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the regexp used to match a specific token. It can be static text or a subpattern.
|
||||
*
|
||||
* @param array $tokens The route tokens
|
||||
* @param int $index The index of the current token
|
||||
* @param int $firstOptional The index of the first optional token
|
||||
*
|
||||
* @return string The regexp pattern for a single token
|
||||
*/
|
||||
private static function computeRegexp(array $tokens, $index, $firstOptional)
|
||||
{
|
||||
$token = $tokens[$index];
|
||||
if ('text' === $token[0]) {
|
||||
// Text tokens
|
||||
return preg_quote($token[1], self::REGEX_DELIMITER);
|
||||
} else {
|
||||
// Variable tokens
|
||||
if (0 === $index && 0 === $firstOptional) {
|
||||
// When the only token is an optional variable token, the separator is required
|
||||
return sprintf('%s(?P<%s>%s)?', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]);
|
||||
} else {
|
||||
$regexp = sprintf('%s(?P<%s>%s)', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]);
|
||||
if ($index >= $firstOptional) {
|
||||
// Enclose each optional token in a subpattern to make it optional.
|
||||
// "?:" 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);
|
||||
if ($nbTokens - 1 == $index) {
|
||||
// Close the optional subpatterns
|
||||
$regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
return $regexp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
32
Laravel/vendor/symfony/routing/RouteCompilerInterface.php
vendored
Normal file
32
Laravel/vendor/symfony/routing/RouteCompilerInterface.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
/**
|
||||
* RouteCompilerInterface is the interface that all RouteCompiler classes must implement.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
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
|
||||
* path or host pattern is invalid
|
||||
*/
|
||||
public static function compile(Route $route);
|
||||
}
|
388
Laravel/vendor/symfony/routing/Router.php
vendored
Normal file
388
Laravel/vendor/symfony/routing/Router.php
vendored
Normal file
@@ -0,0 +1,388 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
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\Routing\Generator\ConfigurableRequirementsInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface;
|
||||
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
|
||||
* routing system for easier use.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Router implements RouterInterface, RequestMatcherInterface
|
||||
{
|
||||
/**
|
||||
* @var UrlMatcherInterface|null
|
||||
*/
|
||||
protected $matcher;
|
||||
|
||||
/**
|
||||
* @var UrlGeneratorInterface|null
|
||||
*/
|
||||
protected $generator;
|
||||
|
||||
/**
|
||||
* @var RequestContext
|
||||
*/
|
||||
protected $context;
|
||||
|
||||
/**
|
||||
* @var LoaderInterface
|
||||
*/
|
||||
protected $loader;
|
||||
|
||||
/**
|
||||
* @var RouteCollection|null
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
protected $resource;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
|
||||
/**
|
||||
* @var LoggerInterface|null
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* @var ConfigCacheFactoryInterface|null
|
||||
*/
|
||||
private $configCacheFactory;
|
||||
|
||||
/**
|
||||
* @var ExpressionFunctionProviderInterface[]
|
||||
*/
|
||||
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
|
||||
* @param RequestContext $context The context
|
||||
* @param LoggerInterface $logger A logger instance
|
||||
*/
|
||||
public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, LoggerInterface $logger = null)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
$this->resource = $resource;
|
||||
$this->logger = $logger;
|
||||
$this->context = $context ?: new RequestContext();
|
||||
$this->setOptions($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets options.
|
||||
*
|
||||
* Available options:
|
||||
*
|
||||
* * cache_dir: The cache directory (or null to disable caching)
|
||||
* * debug: Whether to enable debugging or not (false by default)
|
||||
* * generator_class: The name of a UrlGeneratorInterface implementation
|
||||
* * generator_base_class: The base class for the dumped generator class
|
||||
* * generator_cache_class: The class name for the dumped generator class
|
||||
* * generator_dumper_class: The name of a GeneratorDumperInterface implementation
|
||||
* * matcher_class: The name of a UrlMatcherInterface implementation
|
||||
* * matcher_base_class: The base class for the dumped matcher class
|
||||
* * matcher_dumper_class: The class name for the dumped matcher class
|
||||
* * matcher_cache_class: The name of a MatcherDumperInterface implementation
|
||||
* * resource_type: Type hint for the main resource (optional)
|
||||
* * strict_requirements: Configure strict requirement checking for generators
|
||||
* implementing ConfigurableRequirementsInterface (default is true)
|
||||
*
|
||||
* @param array $options An array of options
|
||||
*
|
||||
* @throws \InvalidArgumentException When unsupported option is provided
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
{
|
||||
$this->options = array(
|
||||
'cache_dir' => null,
|
||||
'debug' => false,
|
||||
'generator_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
|
||||
'generator_base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
|
||||
'generator_dumper_class' => 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper',
|
||||
'generator_cache_class' => 'ProjectUrlGenerator',
|
||||
'matcher_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
|
||||
'matcher_base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
|
||||
'matcher_dumper_class' => 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper',
|
||||
'matcher_cache_class' => 'ProjectUrlMatcher',
|
||||
'resource_type' => null,
|
||||
'strict_requirements' => true,
|
||||
);
|
||||
|
||||
// check option names and live merge, if errors are encountered Exception will be thrown
|
||||
$invalid = array();
|
||||
foreach ($options as $key => $value) {
|
||||
if (array_key_exists($key, $this->options)) {
|
||||
$this->options[$key] = $value;
|
||||
} else {
|
||||
$invalid[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
if ($invalid) {
|
||||
throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('", "', $invalid)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an option.
|
||||
*
|
||||
* @param string $key The key
|
||||
* @param mixed $value The value
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setOption($key, $value)
|
||||
{
|
||||
if (!array_key_exists($key, $this->options)) {
|
||||
throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key));
|
||||
}
|
||||
|
||||
$this->options[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an option value.
|
||||
*
|
||||
* @param string $key The key
|
||||
*
|
||||
* @return mixed The value
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getOption($key)
|
||||
{
|
||||
if (!array_key_exists($key, $this->options)) {
|
||||
throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key));
|
||||
}
|
||||
|
||||
return $this->options[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRouteCollection()
|
||||
{
|
||||
if (null === $this->collection) {
|
||||
$this->collection = $this->loader->load($this->resource, $this->options['resource_type']);
|
||||
}
|
||||
|
||||
return $this->collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setContext(RequestContext $context)
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
if (null !== $this->matcher) {
|
||||
$this->getMatcher()->setContext($context);
|
||||
}
|
||||
if (null !== $this->generator) {
|
||||
$this->getGenerator()->setContext($context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ConfigCache factory to use.
|
||||
*
|
||||
* @param ConfigCacheFactoryInterface $configCacheFactory The factory to use
|
||||
*/
|
||||
public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory)
|
||||
{
|
||||
$this->configCacheFactory = $configCacheFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
|
||||
{
|
||||
return $this->getGenerator()->generate($name, $parameters, $referenceType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function match($pathinfo)
|
||||
{
|
||||
return $this->getMatcher()->match($pathinfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function matchRequest(Request $request)
|
||||
{
|
||||
$matcher = $this->getMatcher();
|
||||
if (!$matcher instanceof RequestMatcherInterface) {
|
||||
// fallback to the default UrlMatcherInterface
|
||||
return $matcher->match($request->getPathInfo());
|
||||
}
|
||||
|
||||
return $matcher->matchRequest($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the UrlMatcher instance associated with this Router.
|
||||
*
|
||||
* @return UrlMatcherInterface A UrlMatcherInterface instance
|
||||
*/
|
||||
public function getMatcher()
|
||||
{
|
||||
if (null !== $this->matcher) {
|
||||
return $this->matcher;
|
||||
}
|
||||
|
||||
if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) {
|
||||
$this->matcher = new $this->options['matcher_class']($this->getRouteCollection(), $this->context);
|
||||
if (method_exists($this->matcher, 'addExpressionLanguageProvider')) {
|
||||
foreach ($this->expressionLanguageProviders as $provider) {
|
||||
$this->matcher->addExpressionLanguageProvider($provider);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->matcher;
|
||||
}
|
||||
|
||||
$cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['matcher_cache_class'].'.php',
|
||||
function (ConfigCacheInterface $cache) {
|
||||
$dumper = $this->getMatcherDumperInstance();
|
||||
if (method_exists($dumper, 'addExpressionLanguageProvider')) {
|
||||
foreach ($this->expressionLanguageProviders as $provider) {
|
||||
$dumper->addExpressionLanguageProvider($provider);
|
||||
}
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'class' => $this->options['matcher_cache_class'],
|
||||
'base_class' => $this->options['matcher_base_class'],
|
||||
);
|
||||
|
||||
$cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
|
||||
}
|
||||
);
|
||||
|
||||
require_once $cache->getPath();
|
||||
|
||||
return $this->matcher = new $this->options['matcher_cache_class']($this->context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the UrlGenerator instance associated with this Router.
|
||||
*
|
||||
* @return UrlGeneratorInterface A UrlGeneratorInterface instance
|
||||
*/
|
||||
public function getGenerator()
|
||||
{
|
||||
if (null !== $this->generator) {
|
||||
return $this->generator;
|
||||
}
|
||||
|
||||
if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) {
|
||||
$this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger);
|
||||
} else {
|
||||
$cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['generator_cache_class'].'.php',
|
||||
function (ConfigCacheInterface $cache) {
|
||||
$dumper = $this->getGeneratorDumperInstance();
|
||||
|
||||
$options = array(
|
||||
'class' => $this->options['generator_cache_class'],
|
||||
'base_class' => $this->options['generator_base_class'],
|
||||
);
|
||||
|
||||
$cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
|
||||
}
|
||||
);
|
||||
|
||||
require_once $cache->getPath();
|
||||
|
||||
$this->generator = new $this->options['generator_cache_class']($this->context, $this->logger);
|
||||
}
|
||||
|
||||
if ($this->generator instanceof ConfigurableRequirementsInterface) {
|
||||
$this->generator->setStrictRequirements($this->options['strict_requirements']);
|
||||
}
|
||||
|
||||
return $this->generator;
|
||||
}
|
||||
|
||||
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
|
||||
{
|
||||
$this->expressionLanguageProviders[] = $provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return GeneratorDumperInterface
|
||||
*/
|
||||
protected function getGeneratorDumperInstance()
|
||||
{
|
||||
return new $this->options['generator_dumper_class']($this->getRouteCollection());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MatcherDumperInterface
|
||||
*/
|
||||
protected function getMatcherDumperInstance()
|
||||
{
|
||||
return new $this->options['matcher_dumper_class']($this->getRouteCollection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the ConfigCache factory implementation, falling back to a
|
||||
* default implementation if necessary.
|
||||
*
|
||||
* @return ConfigCacheFactoryInterface $configCacheFactory
|
||||
*/
|
||||
private function getConfigCacheFactory()
|
||||
{
|
||||
if (null === $this->configCacheFactory) {
|
||||
$this->configCacheFactory = new ConfigCacheFactory($this->options['debug']);
|
||||
}
|
||||
|
||||
return $this->configCacheFactory;
|
||||
}
|
||||
}
|
32
Laravel/vendor/symfony/routing/RouterInterface.php
vendored
Normal file
32
Laravel/vendor/symfony/routing/RouterInterface.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing;
|
||||
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
|
||||
|
||||
/**
|
||||
* RouterInterface is the interface that all Router classes must implement.
|
||||
*
|
||||
* This interface is the concatenation of UrlMatcherInterface and UrlGeneratorInterface.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface
|
||||
{
|
||||
/**
|
||||
* Gets the RouteCollection instance associated with this Router.
|
||||
*
|
||||
* @return RouteCollection A RouteCollection instance
|
||||
*/
|
||||
public function getRouteCollection();
|
||||
}
|
50
Laravel/vendor/symfony/routing/Tests/Annotation/RouteTest.php
vendored
Normal file
50
Laravel/vendor/symfony/routing/Tests/Annotation/RouteTest.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Annotation;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class RouteTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \BadMethodCallException
|
||||
*/
|
||||
public function testInvalidRouteParameter()
|
||||
{
|
||||
$route = new Route(array('foo' => 'bar'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getValidParameters
|
||||
*/
|
||||
public function testRouteParameters($parameter, $value, $getter)
|
||||
{
|
||||
$route = new Route(array($parameter => $value));
|
||||
$this->assertEquals($route->$getter(), $value);
|
||||
}
|
||||
|
||||
public function getValidParameters()
|
||||
{
|
||||
return array(
|
||||
array('value', '/Blog', 'getPath'),
|
||||
array('requirements', array('locale' => 'en'), 'getRequirements'),
|
||||
array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'),
|
||||
array('name', 'blog_index', 'getName'),
|
||||
array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults'),
|
||||
array('schemes', array('https'), 'getSchemes'),
|
||||
array('methods', array('GET', 'POST'), 'getMethods'),
|
||||
array('host', '{locale}.example.com', 'getHost'),
|
||||
array('condition', 'context.getMethod() == "GET"', 'getCondition'),
|
||||
);
|
||||
}
|
||||
}
|
27
Laravel/vendor/symfony/routing/Tests/CompiledRouteTest.php
vendored
Normal file
27
Laravel/vendor/symfony/routing/Tests/CompiledRouteTest.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Routing\CompiledRoute;
|
||||
|
||||
class CompiledRouteTest extends TestCase
|
||||
{
|
||||
public function testAccessors()
|
||||
{
|
||||
$compiled = new CompiledRoute('prefix', 'regex', array('tokens'), array(), array(), 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');
|
||||
$this->assertEquals(array('variables'), $compiled->getVariables(), '__construct() takes an array of variables as its ninth argument');
|
||||
}
|
||||
}
|
36
Laravel/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php
vendored
Normal file
36
Laravel/vendor/symfony/routing/Tests/DependencyInjection/RoutingResolverPassTest.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\Routing\DependencyInjection\RoutingResolverPass;
|
||||
|
||||
class RoutingResolverPassTest extends TestCase
|
||||
{
|
||||
public function testProcess()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('routing.resolver', LoaderResolver::class);
|
||||
$container->register('loader1')->addTag('routing.loader');
|
||||
$container->register('loader2')->addTag('routing.loader');
|
||||
|
||||
(new RoutingResolverPass())->process($container);
|
||||
|
||||
$this->assertEquals(
|
||||
array(array('addLoader', array(new Reference('loader1'))), array('addLoader', array(new Reference('loader2')))),
|
||||
$container->getDefinition('routing.resolver')->getMethodCalls()
|
||||
);
|
||||
}
|
||||
}
|
16
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php
vendored
Normal file
16
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses;
|
||||
|
||||
abstract class AbstractClass
|
||||
{
|
||||
}
|
19
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BarClass.php
vendored
Normal file
19
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BarClass.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses;
|
||||
|
||||
class BarClass
|
||||
{
|
||||
public function routeAction($arg1, $arg2 = 'defaultValue2', $arg3 = 'defaultValue3')
|
||||
{
|
||||
}
|
||||
}
|
19
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BazClass.php
vendored
Normal file
19
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/BazClass.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses;
|
||||
|
||||
class BazClass
|
||||
{
|
||||
public function __invoke()
|
||||
{
|
||||
}
|
||||
}
|
16
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooClass.php
vendored
Normal file
16
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooClass.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses;
|
||||
|
||||
class FooClass
|
||||
{
|
||||
}
|
13
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php
vendored
Normal file
13
Laravel/vendor/symfony/routing/Tests/Fixtures/AnnotatedClasses/FooTrait.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses;
|
||||
|
||||
trait FooTrait
|
||||
{
|
||||
public function doBar()
|
||||
{
|
||||
$baz = self::class;
|
||||
if (true) {
|
||||
}
|
||||
}
|
||||
}
|
18
Laravel/vendor/symfony/routing/Tests/Fixtures/CustomCompiledRoute.php
vendored
Normal file
18
Laravel/vendor/symfony/routing/Tests/Fixtures/CustomCompiledRoute.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Routing\CompiledRoute;
|
||||
|
||||
class CustomCompiledRoute extends CompiledRoute
|
||||
{
|
||||
}
|
26
Laravel/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php
vendored
Normal file
26
Laravel/vendor/symfony/routing/Tests/Fixtures/CustomRouteCompiler.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Routing\RouteCompiler;
|
||||
|
||||
class CustomRouteCompiler extends RouteCompiler
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function compile(Route $route)
|
||||
{
|
||||
return new CustomCompiledRoute('', '', array(), array());
|
||||
}
|
||||
}
|
26
Laravel/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php
vendored
Normal file
26
Laravel/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Routing\Loader\XmlFileLoader;
|
||||
use Symfony\Component\Config\Util\XmlUtils;
|
||||
|
||||
/**
|
||||
* XmlFileLoader with schema validation turned off.
|
||||
*/
|
||||
class CustomXmlFileLoader extends XmlFileLoader
|
||||
{
|
||||
protected function loadFile($file)
|
||||
{
|
||||
return XmlUtils::loadFile($file, function () { return true; });
|
||||
}
|
||||
}
|
3
Laravel/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/NoStartTagClass.php
vendored
Normal file
3
Laravel/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/NoStartTagClass.php
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
class NoStartTagClass
|
||||
{
|
||||
}
|
19
Laravel/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php
vendored
Normal file
19
Laravel/vendor/symfony/routing/Tests/Fixtures/OtherAnnotatedClasses/VariadicClass.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures\OtherAnnotatedClasses;
|
||||
|
||||
class VariadicClass
|
||||
{
|
||||
public function routeAction(...$params)
|
||||
{
|
||||
}
|
||||
}
|
30
Laravel/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php
vendored
Normal file
30
Laravel/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcher;
|
||||
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface
|
||||
{
|
||||
public function redirect($path, $route, $scheme = null)
|
||||
{
|
||||
return array(
|
||||
'_controller' => 'Some controller reference...',
|
||||
'path' => $path,
|
||||
'scheme' => $scheme,
|
||||
);
|
||||
}
|
||||
}
|
0
Laravel/vendor/symfony/routing/Tests/Fixtures/annotated.php
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/annotated.php
vendored
Normal file
3
Laravel/vendor/symfony/routing/Tests/Fixtures/bad_format.yml
vendored
Normal file
3
Laravel/vendor/symfony/routing/Tests/Fixtures/bad_format.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
blog_show:
|
||||
path: /blog/{slug}
|
||||
defaults: { _controller: "MyBundle:Blog:show" }
|
0
Laravel/vendor/symfony/routing/Tests/Fixtures/bar.xml
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/bar.xml
vendored
Normal file
2
Laravel/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml
vendored
Normal file
2
Laravel/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes1.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
route1:
|
||||
path: /route/1
|
2
Laravel/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml
vendored
Normal file
2
Laravel/vendor/symfony/routing/Tests/Fixtures/directory/recurse/routes2.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
route2:
|
||||
path: /route/2
|
2
Laravel/vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml
vendored
Normal file
2
Laravel/vendor/symfony/routing/Tests/Fixtures/directory/routes3.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
route3:
|
||||
path: /route/3
|
3
Laravel/vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml
vendored
Normal file
3
Laravel/vendor/symfony/routing/Tests/Fixtures/directory_import/import.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
_directory:
|
||||
resource: "../directory"
|
||||
type: directory
|
163
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.apache
vendored
Normal file
163
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.apache
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
# 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]
|
317
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php
vendored
Normal file
317
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php
vendored
Normal file
@@ -0,0 +1,317 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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)
|
||||
{
|
||||
$allow = array();
|
||||
$pathinfo = rawurldecode($pathinfo);
|
||||
$trimmedPathinfo = rtrim($pathinfo, '/');
|
||||
$context = $this->context;
|
||||
$request = $this->request;
|
||||
$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)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
|
||||
}
|
||||
|
||||
// foofoo
|
||||
if ('/foofoo' === $pathinfo) {
|
||||
return array ( 'def' => 'test', '_route' => 'foofoo',);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/bar')) {
|
||||
// bar
|
||||
if (preg_match('#^/bar/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_bar;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
|
||||
}
|
||||
not_bar:
|
||||
|
||||
// barhead
|
||||
if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_barhead;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
|
||||
}
|
||||
not_barhead:
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/test')) {
|
||||
if (0 === strpos($pathinfo, '/test/baz')) {
|
||||
// baz
|
||||
if ('/test/baz' === $pathinfo) {
|
||||
return array('_route' => 'baz');
|
||||
}
|
||||
|
||||
// baz2
|
||||
if ('/test/baz.html' === $pathinfo) {
|
||||
return array('_route' => 'baz2');
|
||||
}
|
||||
|
||||
// baz3
|
||||
if ('/test/baz3/' === $pathinfo) {
|
||||
return array('_route' => 'baz3');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// baz4
|
||||
if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $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';
|
||||
goto not_baz5;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
|
||||
}
|
||||
not_baz5:
|
||||
|
||||
// baz.baz6
|
||||
if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
|
||||
if ('PUT' !== $canonicalMethod) {
|
||||
$allow[] = 'PUT';
|
||||
goto not_bazbaz6;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
|
||||
}
|
||||
not_bazbaz6:
|
||||
|
||||
}
|
||||
|
||||
// quoter
|
||||
if (preg_match('#^/(?P<quoter>[\']+)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
|
||||
}
|
||||
|
||||
// space
|
||||
if ('/spa ce' === $pathinfo) {
|
||||
return array('_route' => 'space');
|
||||
}
|
||||
|
||||
if (0 === strpos($pathinfo, '/a')) {
|
||||
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
||||
// foo1
|
||||
if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
|
||||
}
|
||||
|
||||
// bar1
|
||||
if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// overridden
|
||||
if (preg_match('#^/a/(?P<var>.*)$#s', $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)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
|
||||
}
|
||||
|
||||
// bar2
|
||||
if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/multi')) {
|
||||
// helloWorld
|
||||
if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
|
||||
}
|
||||
|
||||
// hey
|
||||
if ('/multi/hey/' === $pathinfo) {
|
||||
return array('_route' => 'hey');
|
||||
}
|
||||
|
||||
// overridden2
|
||||
if ('/multi/new' === $pathinfo) {
|
||||
return array('_route' => 'overridden2');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// foo3
|
||||
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
|
||||
}
|
||||
|
||||
// bar3
|
||||
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
|
||||
}
|
||||
|
||||
if (0 === strpos($pathinfo, '/aba')) {
|
||||
// ababa
|
||||
if ('/ababa' === $pathinfo) {
|
||||
return array('_route' => 'ababa');
|
||||
}
|
||||
|
||||
// foo4
|
||||
if (preg_match('#^/aba/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$host = $context->getHost();
|
||||
|
||||
if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route1
|
||||
if ('/route1' === $pathinfo) {
|
||||
return array('_route' => 'route1');
|
||||
}
|
||||
|
||||
// route2
|
||||
if ('/c2/route2' === $pathinfo) {
|
||||
return array('_route' => 'route2');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route3
|
||||
if ('/c2/route3' === $pathinfo) {
|
||||
return array('_route' => 'route3');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route4
|
||||
if ('/route4' === $pathinfo) {
|
||||
return array('_route' => 'route4');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route5
|
||||
if ('/route5' === $pathinfo) {
|
||||
return array('_route' => 'route5');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// route6
|
||||
if ('/route6' === $pathinfo) {
|
||||
return array('_route' => 'route6');
|
||||
}
|
||||
|
||||
if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
if (0 === strpos($pathinfo, '/route1')) {
|
||||
// route11
|
||||
if ('/route11' === $pathinfo) {
|
||||
return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ());
|
||||
}
|
||||
|
||||
// route12
|
||||
if ('/route12' === $pathinfo) {
|
||||
return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',));
|
||||
}
|
||||
|
||||
// route13
|
||||
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#s', $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)) {
|
||||
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route15
|
||||
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#s', $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)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
|
||||
}
|
||||
|
||||
// route17
|
||||
if ('/route17' === $pathinfo) {
|
||||
return array('_route' => 'route17');
|
||||
}
|
||||
|
||||
// a
|
||||
if ('/a/a...' === $pathinfo) {
|
||||
return array('_route' => 'a');
|
||||
}
|
||||
|
||||
if (0 === strpos($pathinfo, '/a/b')) {
|
||||
// b
|
||||
if (preg_match('#^/a/b/(?P<var>[^/]++)$#s', $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)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
7
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.apache
vendored
Normal file
7
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.apache
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# 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]
|
349
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php
vendored
Normal file
349
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php
vendored
Normal file
@@ -0,0 +1,349 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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)
|
||||
{
|
||||
$allow = array();
|
||||
$pathinfo = rawurldecode($pathinfo);
|
||||
$trimmedPathinfo = rtrim($pathinfo, '/');
|
||||
$context = $this->context;
|
||||
$request = $this->request;
|
||||
$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)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
|
||||
}
|
||||
|
||||
// foofoo
|
||||
if ('/foofoo' === $pathinfo) {
|
||||
return array ( 'def' => 'test', '_route' => 'foofoo',);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/bar')) {
|
||||
// bar
|
||||
if (preg_match('#^/bar/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_bar;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
|
||||
}
|
||||
not_bar:
|
||||
|
||||
// barhead
|
||||
if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_barhead;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
|
||||
}
|
||||
not_barhead:
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/test')) {
|
||||
if (0 === strpos($pathinfo, '/test/baz')) {
|
||||
// baz
|
||||
if ('/test/baz' === $pathinfo) {
|
||||
return array('_route' => 'baz');
|
||||
}
|
||||
|
||||
// baz2
|
||||
if ('/test/baz.html' === $pathinfo) {
|
||||
return array('_route' => 'baz2');
|
||||
}
|
||||
|
||||
// baz3
|
||||
if ('/test/baz3' === $trimmedPathinfo) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'baz3');
|
||||
}
|
||||
|
||||
return array('_route' => 'baz3');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// baz4
|
||||
if (preg_match('#^/test/(?P<foo>[^/]++)/?$#s', $pathinfo, $matches)) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'baz4');
|
||||
}
|
||||
|
||||
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';
|
||||
goto not_baz5;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
|
||||
}
|
||||
not_baz5:
|
||||
|
||||
// baz.baz6
|
||||
if (preg_match('#^/test/(?P<foo>[^/]++)/$#s', $pathinfo, $matches)) {
|
||||
if ('PUT' !== $canonicalMethod) {
|
||||
$allow[] = 'PUT';
|
||||
goto not_bazbaz6;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
|
||||
}
|
||||
not_bazbaz6:
|
||||
|
||||
}
|
||||
|
||||
// quoter
|
||||
if (preg_match('#^/(?P<quoter>[\']+)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
|
||||
}
|
||||
|
||||
// space
|
||||
if ('/spa ce' === $pathinfo) {
|
||||
return array('_route' => 'space');
|
||||
}
|
||||
|
||||
if (0 === strpos($pathinfo, '/a')) {
|
||||
if (0 === strpos($pathinfo, '/a/b\'b')) {
|
||||
// foo1
|
||||
if (preg_match('#^/a/b\'b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
|
||||
}
|
||||
|
||||
// bar1
|
||||
if (preg_match('#^/a/b\'b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// overridden
|
||||
if (preg_match('#^/a/(?P<var>.*)$#s', $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)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
|
||||
}
|
||||
|
||||
// bar2
|
||||
if (preg_match('#^/a/b\'b/(?P<bar1>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/multi')) {
|
||||
// helloWorld
|
||||
if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P<who>[^/]++))?$#s', $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');
|
||||
}
|
||||
|
||||
return array('_route' => 'hey');
|
||||
}
|
||||
|
||||
// overridden2
|
||||
if ('/multi/new' === $pathinfo) {
|
||||
return array('_route' => 'overridden2');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// foo3
|
||||
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
|
||||
}
|
||||
|
||||
// bar3
|
||||
if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P<bar>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
|
||||
}
|
||||
|
||||
if (0 === strpos($pathinfo, '/aba')) {
|
||||
// ababa
|
||||
if ('/ababa' === $pathinfo) {
|
||||
return array('_route' => 'ababa');
|
||||
}
|
||||
|
||||
// foo4
|
||||
if (preg_match('#^/aba/(?P<foo>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$host = $context->getHost();
|
||||
|
||||
if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route1
|
||||
if ('/route1' === $pathinfo) {
|
||||
return array('_route' => 'route1');
|
||||
}
|
||||
|
||||
// route2
|
||||
if ('/c2/route2' === $pathinfo) {
|
||||
return array('_route' => 'route2');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route3
|
||||
if ('/c2/route3' === $pathinfo) {
|
||||
return array('_route' => 'route3');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route4
|
||||
if ('/route4' === $pathinfo) {
|
||||
return array('_route' => 'route4');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route5
|
||||
if ('/route5' === $pathinfo) {
|
||||
return array('_route' => 'route5');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// route6
|
||||
if ('/route6' === $pathinfo) {
|
||||
return array('_route' => 'route6');
|
||||
}
|
||||
|
||||
if (preg_match('#^(?P<var1>[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
if (0 === strpos($pathinfo, '/route1')) {
|
||||
// route11
|
||||
if ('/route11' === $pathinfo) {
|
||||
return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ());
|
||||
}
|
||||
|
||||
// route12
|
||||
if ('/route12' === $pathinfo) {
|
||||
return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',));
|
||||
}
|
||||
|
||||
// route13
|
||||
if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P<name>[^/]++)$#s', $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)) {
|
||||
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
|
||||
// route15
|
||||
if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P<name>[^/]++)$#s', $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)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
|
||||
}
|
||||
|
||||
// route17
|
||||
if ('/route17' === $pathinfo) {
|
||||
return array('_route' => 'route17');
|
||||
}
|
||||
|
||||
// a
|
||||
if ('/a/a...' === $pathinfo) {
|
||||
return array('_route' => 'a');
|
||||
}
|
||||
|
||||
if (0 === strpos($pathinfo, '/a/b')) {
|
||||
// b
|
||||
if (preg_match('#^/a/b/(?P<var>[^/]++)$#s', $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)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// secure
|
||||
if ('/secure' === $pathinfo) {
|
||||
$requiredSchemes = array ( 'https' => 0,);
|
||||
if (!isset($requiredSchemes[$scheme])) {
|
||||
return $this->redirect($pathinfo, 'secure', key($requiredSchemes));
|
||||
}
|
||||
|
||||
return array('_route' => 'secure');
|
||||
}
|
||||
|
||||
// nonsecure
|
||||
if ('/nonsecure' === $pathinfo) {
|
||||
$requiredSchemes = array ( 'http' => 0,);
|
||||
if (!isset($requiredSchemes[$scheme])) {
|
||||
return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes));
|
||||
}
|
||||
|
||||
return array('_route' => 'nonsecure');
|
||||
}
|
||||
|
||||
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
58
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php
vendored
Normal file
58
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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)
|
||||
{
|
||||
$allow = array();
|
||||
$pathinfo = rawurldecode($pathinfo);
|
||||
$trimmedPathinfo = rtrim($pathinfo, '/');
|
||||
$context = $this->context;
|
||||
$request = $this->request;
|
||||
$requestMethod = $canonicalMethod = $context->getMethod();
|
||||
$scheme = $context->getScheme();
|
||||
|
||||
if ('HEAD' === $requestMethod) {
|
||||
$canonicalMethod = 'GET';
|
||||
}
|
||||
|
||||
|
||||
if (0 === strpos($pathinfo, '/rootprefix')) {
|
||||
// static
|
||||
if ('/rootprefix/test' === $pathinfo) {
|
||||
return array('_route' => 'static');
|
||||
}
|
||||
|
||||
// dynamic
|
||||
if (preg_match('#^/rootprefix/(?P<var>[^/]++)$#s', $pathinfo, $matches)) {
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// with-condition
|
||||
if ('/with-condition' === $pathinfo && ($context->getMethod() == "GET")) {
|
||||
return array('_route' => 'with-condition');
|
||||
}
|
||||
|
||||
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
109
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php
vendored
Normal file
109
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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)
|
||||
{
|
||||
$allow = array();
|
||||
$pathinfo = rawurldecode($pathinfo);
|
||||
$trimmedPathinfo = rtrim($pathinfo, '/');
|
||||
$context = $this->context;
|
||||
$request = $this->request;
|
||||
$requestMethod = $canonicalMethod = $context->getMethod();
|
||||
$scheme = $context->getScheme();
|
||||
|
||||
if ('HEAD' === $requestMethod) {
|
||||
$canonicalMethod = 'GET';
|
||||
}
|
||||
|
||||
|
||||
// just_head
|
||||
if ('/just_head' === $pathinfo) {
|
||||
if ('HEAD' !== $requestMethod) {
|
||||
$allow[] = 'HEAD';
|
||||
goto not_just_head;
|
||||
}
|
||||
|
||||
return array('_route' => 'just_head');
|
||||
}
|
||||
not_just_head:
|
||||
|
||||
// head_and_get
|
||||
if ('/head_and_get' === $pathinfo) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_head_and_get;
|
||||
}
|
||||
|
||||
return array('_route' => 'head_and_get');
|
||||
}
|
||||
not_head_and_get:
|
||||
|
||||
// get_and_head
|
||||
if ('/get_and_head' === $pathinfo) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_get_and_head;
|
||||
}
|
||||
|
||||
return array('_route' => 'get_and_head');
|
||||
}
|
||||
not_get_and_head:
|
||||
|
||||
// post_and_head
|
||||
if ('/post_and_get' === $pathinfo) {
|
||||
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');
|
||||
}
|
||||
not_post_and_head:
|
||||
|
||||
if (0 === strpos($pathinfo, '/put_and_post')) {
|
||||
// put_and_post
|
||||
if ('/put_and_post' === $pathinfo) {
|
||||
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');
|
||||
}
|
||||
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'));
|
||||
goto not_put_and_get_and_head;
|
||||
}
|
||||
|
||||
return array('_route' => 'put_and_get_and_head');
|
||||
}
|
||||
not_put_and_get_and_head:
|
||||
|
||||
}
|
||||
|
||||
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
158
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php
vendored
Normal file
158
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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)
|
||||
{
|
||||
$allow = array();
|
||||
$pathinfo = rawurldecode($pathinfo);
|
||||
$trimmedPathinfo = rtrim($pathinfo, '/');
|
||||
$context = $this->context;
|
||||
$request = $this->request;
|
||||
$requestMethod = $canonicalMethod = $context->getMethod();
|
||||
$scheme = $context->getScheme();
|
||||
|
||||
if ('HEAD' === $requestMethod) {
|
||||
$canonicalMethod = 'GET';
|
||||
}
|
||||
|
||||
|
||||
if (0 === strpos($pathinfo, '/a')) {
|
||||
// a_first
|
||||
if ('/a/11' === $pathinfo) {
|
||||
return array('_route' => 'a_first');
|
||||
}
|
||||
|
||||
// a_second
|
||||
if ('/a/22' === $pathinfo) {
|
||||
return array('_route' => 'a_second');
|
||||
}
|
||||
|
||||
// a_third
|
||||
if ('/a/333' === $pathinfo) {
|
||||
return array('_route' => 'a_third');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// a_wildcard
|
||||
if (preg_match('#^/(?P<param>[^/]++)$#s', $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');
|
||||
}
|
||||
|
||||
return array('_route' => 'a_fourth');
|
||||
}
|
||||
|
||||
// a_fifth
|
||||
if ('/a/55' === $trimmedPathinfo) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'a_fifth');
|
||||
}
|
||||
|
||||
return array('_route' => 'a_fifth');
|
||||
}
|
||||
|
||||
// a_sixth
|
||||
if ('/a/66' === $trimmedPathinfo) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'a_sixth');
|
||||
}
|
||||
|
||||
return array('_route' => 'a_sixth');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// nested_wildcard
|
||||
if (0 === strpos($pathinfo, '/nested') && preg_match('#^/nested/(?P<param>[^/]++)$#s', $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');
|
||||
}
|
||||
|
||||
return array('_route' => 'nested_a');
|
||||
}
|
||||
|
||||
// nested_b
|
||||
if ('/nested/group/b' === $trimmedPathinfo) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'nested_b');
|
||||
}
|
||||
|
||||
return array('_route' => 'nested_b');
|
||||
}
|
||||
|
||||
// nested_c
|
||||
if ('/nested/group/c' === $trimmedPathinfo) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'nested_c');
|
||||
}
|
||||
|
||||
return array('_route' => 'nested_c');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/slashed/group')) {
|
||||
// slashed_a
|
||||
if ('/slashed/group' === $trimmedPathinfo) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'slashed_a');
|
||||
}
|
||||
|
||||
return array('_route' => 'slashed_a');
|
||||
}
|
||||
|
||||
// slashed_b
|
||||
if ('/slashed/group/b' === $trimmedPathinfo) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'slashed_b');
|
||||
}
|
||||
|
||||
return array('_route' => 'slashed_b');
|
||||
}
|
||||
|
||||
// slashed_c
|
||||
if ('/slashed/group/c' === $trimmedPathinfo) {
|
||||
if (substr($pathinfo, -1) !== '/') {
|
||||
return $this->redirect($pathinfo.'/', 'slashed_c');
|
||||
}
|
||||
|
||||
return array('_route' => 'slashed_c');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
204
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php
vendored
Normal file
204
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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)
|
||||
{
|
||||
$allow = array();
|
||||
$pathinfo = rawurldecode($pathinfo);
|
||||
$trimmedPathinfo = rtrim($pathinfo, '/');
|
||||
$context = $this->context;
|
||||
$request = $this->request;
|
||||
$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) {
|
||||
return array('_route' => 'simple_trailing_slash_no_methods');
|
||||
}
|
||||
|
||||
// simple_trailing_slash_GET_method
|
||||
if ('/trailing/simple/get-method/' === $pathinfo) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_simple_trailing_slash_GET_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_trailing_slash_GET_method');
|
||||
}
|
||||
not_simple_trailing_slash_GET_method:
|
||||
|
||||
// simple_trailing_slash_HEAD_method
|
||||
if ('/trailing/simple/head-method/' === $pathinfo) {
|
||||
if ('HEAD' !== $requestMethod) {
|
||||
$allow[] = 'HEAD';
|
||||
goto not_simple_trailing_slash_HEAD_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_trailing_slash_HEAD_method');
|
||||
}
|
||||
not_simple_trailing_slash_HEAD_method:
|
||||
|
||||
// simple_trailing_slash_POST_method
|
||||
if ('/trailing/simple/post-method/' === $pathinfo) {
|
||||
if ('POST' !== $canonicalMethod) {
|
||||
$allow[] = 'POST';
|
||||
goto not_simple_trailing_slash_POST_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_trailing_slash_POST_method');
|
||||
}
|
||||
not_simple_trailing_slash_POST_method:
|
||||
|
||||
}
|
||||
|
||||
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)) {
|
||||
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';
|
||||
goto not_regex_trailing_slash_GET_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
|
||||
}
|
||||
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';
|
||||
goto not_regex_trailing_slash_HEAD_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
|
||||
}
|
||||
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';
|
||||
goto not_regex_trailing_slash_POST_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
|
||||
}
|
||||
not_regex_trailing_slash_POST_method:
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/not-trailing/simple')) {
|
||||
// simple_not_trailing_slash_no_methods
|
||||
if ('/not-trailing/simple/no-methods' === $pathinfo) {
|
||||
return array('_route' => 'simple_not_trailing_slash_no_methods');
|
||||
}
|
||||
|
||||
// simple_not_trailing_slash_GET_method
|
||||
if ('/not-trailing/simple/get-method' === $pathinfo) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_simple_not_trailing_slash_GET_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_not_trailing_slash_GET_method');
|
||||
}
|
||||
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';
|
||||
goto not_simple_not_trailing_slash_HEAD_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_not_trailing_slash_HEAD_method');
|
||||
}
|
||||
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';
|
||||
goto not_simple_not_trailing_slash_POST_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_not_trailing_slash_POST_method');
|
||||
}
|
||||
not_simple_not_trailing_slash_POST_method:
|
||||
|
||||
}
|
||||
|
||||
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)) {
|
||||
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';
|
||||
goto not_regex_not_trailing_slash_GET_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
|
||||
}
|
||||
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';
|
||||
goto not_regex_not_trailing_slash_HEAD_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
|
||||
}
|
||||
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';
|
||||
goto not_regex_not_trailing_slash_POST_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
|
||||
}
|
||||
not_regex_not_trailing_slash_POST_method:
|
||||
|
||||
}
|
||||
|
||||
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
228
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php
vendored
Normal file
228
Laravel/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php
vendored
Normal file
@@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
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)
|
||||
{
|
||||
$allow = array();
|
||||
$pathinfo = rawurldecode($pathinfo);
|
||||
$trimmedPathinfo = rtrim($pathinfo, '/');
|
||||
$context = $this->context;
|
||||
$request = $this->request;
|
||||
$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');
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_trailing_slash_no_methods');
|
||||
}
|
||||
|
||||
// simple_trailing_slash_GET_method
|
||||
if ('/trailing/simple/get-method' === $trimmedPathinfo) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = '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');
|
||||
}
|
||||
not_simple_trailing_slash_GET_method:
|
||||
|
||||
// simple_trailing_slash_HEAD_method
|
||||
if ('/trailing/simple/head-method' === $trimmedPathinfo) {
|
||||
if ('HEAD' !== $requestMethod) {
|
||||
$allow[] = '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');
|
||||
}
|
||||
not_simple_trailing_slash_HEAD_method:
|
||||
|
||||
// simple_trailing_slash_POST_method
|
||||
if ('/trailing/simple/post-method/' === $pathinfo) {
|
||||
if ('POST' !== $canonicalMethod) {
|
||||
$allow[] = 'POST';
|
||||
goto not_simple_trailing_slash_POST_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_trailing_slash_POST_method');
|
||||
}
|
||||
not_simple_trailing_slash_POST_method:
|
||||
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
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';
|
||||
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 ());
|
||||
}
|
||||
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';
|
||||
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 ());
|
||||
}
|
||||
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';
|
||||
goto not_regex_trailing_slash_POST_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
|
||||
}
|
||||
not_regex_trailing_slash_POST_method:
|
||||
|
||||
}
|
||||
|
||||
elseif (0 === strpos($pathinfo, '/not-trailing/simple')) {
|
||||
// simple_not_trailing_slash_no_methods
|
||||
if ('/not-trailing/simple/no-methods' === $pathinfo) {
|
||||
return array('_route' => 'simple_not_trailing_slash_no_methods');
|
||||
}
|
||||
|
||||
// simple_not_trailing_slash_GET_method
|
||||
if ('/not-trailing/simple/get-method' === $pathinfo) {
|
||||
if ('GET' !== $canonicalMethod) {
|
||||
$allow[] = 'GET';
|
||||
goto not_simple_not_trailing_slash_GET_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_not_trailing_slash_GET_method');
|
||||
}
|
||||
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';
|
||||
goto not_simple_not_trailing_slash_HEAD_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_not_trailing_slash_HEAD_method');
|
||||
}
|
||||
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';
|
||||
goto not_simple_not_trailing_slash_POST_method;
|
||||
}
|
||||
|
||||
return array('_route' => 'simple_not_trailing_slash_POST_method');
|
||||
}
|
||||
not_simple_not_trailing_slash_POST_method:
|
||||
|
||||
}
|
||||
|
||||
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)) {
|
||||
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';
|
||||
goto not_regex_not_trailing_slash_GET_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
|
||||
}
|
||||
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';
|
||||
goto not_regex_not_trailing_slash_HEAD_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
|
||||
}
|
||||
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';
|
||||
goto not_regex_not_trailing_slash_POST_method;
|
||||
}
|
||||
|
||||
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
|
||||
}
|
||||
not_regex_not_trailing_slash_POST_method:
|
||||
|
||||
}
|
||||
|
||||
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
|
||||
}
|
||||
}
|
0
Laravel/vendor/symfony/routing/Tests/Fixtures/empty.yml
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/empty.yml
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/file_resource.yml
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/file_resource.yml
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/foo.xml
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/foo.xml
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/foo1.xml
vendored
Normal file
0
Laravel/vendor/symfony/routing/Tests/Fixtures/foo1.xml
vendored
Normal file
2
Laravel/vendor/symfony/routing/Tests/Fixtures/incomplete.yml
vendored
Normal file
2
Laravel/vendor/symfony/routing/Tests/Fixtures/incomplete.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
blog_show:
|
||||
defaults: { _controller: MyBlogBundle:Blog:show }
|
20
Laravel/vendor/symfony/routing/Tests/Fixtures/list_defaults.xml
vendored
Normal file
20
Laravel/vendor/symfony/routing/Tests/Fixtures/list_defaults.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog" path="/blog">
|
||||
<default key="_controller">
|
||||
<string>AcmeBlogBundle:Blog:index</string>
|
||||
</default>
|
||||
<default key="values">
|
||||
<list>
|
||||
<bool>true</bool>
|
||||
<int>1</int>
|
||||
<float>3.5</float>
|
||||
<string>foo</string>
|
||||
</list>
|
||||
</default>
|
||||
</route>
|
||||
</routes>
|
22
Laravel/vendor/symfony/routing/Tests/Fixtures/list_in_list_defaults.xml
vendored
Normal file
22
Laravel/vendor/symfony/routing/Tests/Fixtures/list_in_list_defaults.xml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog" path="/blog">
|
||||
<default key="_controller">
|
||||
<string>AcmeBlogBundle:Blog:index</string>
|
||||
</default>
|
||||
<default key="values">
|
||||
<list>
|
||||
<list>
|
||||
<bool>true</bool>
|
||||
<int>1</int>
|
||||
<float>3.5</float>
|
||||
<string>foo</string>
|
||||
</list>
|
||||
</list>
|
||||
</default>
|
||||
</route>
|
||||
</routes>
|
22
Laravel/vendor/symfony/routing/Tests/Fixtures/list_in_map_defaults.xml
vendored
Normal file
22
Laravel/vendor/symfony/routing/Tests/Fixtures/list_in_map_defaults.xml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog" path="/blog">
|
||||
<default key="_controller">
|
||||
<string>AcmeBlogBundle:Blog:index</string>
|
||||
</default>
|
||||
<default key="values">
|
||||
<map>
|
||||
<list key="list">
|
||||
<bool>true</bool>
|
||||
<int>1</int>
|
||||
<float>3.5</float>
|
||||
<string>foo</string>
|
||||
</list>
|
||||
</map>
|
||||
</default>
|
||||
</route>
|
||||
</routes>
|
22
Laravel/vendor/symfony/routing/Tests/Fixtures/list_null_values.xml
vendored
Normal file
22
Laravel/vendor/symfony/routing/Tests/Fixtures/list_null_values.xml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog" path="/blog">
|
||||
<default key="_controller">
|
||||
<string>AcmeBlogBundle:Blog:index</string>
|
||||
</default>
|
||||
<default key="list">
|
||||
<list>
|
||||
<bool xsi:nil="true" />
|
||||
<int xsi:nil="true" />
|
||||
<float xsi:nil="1" />
|
||||
<string xsi:nil="true" />
|
||||
<list xsi:nil="true" />
|
||||
<map xsi:nil="true" />
|
||||
</list>
|
||||
</default>
|
||||
</route>
|
||||
</routes>
|
20
Laravel/vendor/symfony/routing/Tests/Fixtures/map_defaults.xml
vendored
Normal file
20
Laravel/vendor/symfony/routing/Tests/Fixtures/map_defaults.xml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog" path="/blog">
|
||||
<default key="_controller">
|
||||
<string>AcmeBlogBundle:Blog:index</string>
|
||||
</default>
|
||||
<default key="values">
|
||||
<map>
|
||||
<bool key="public">true</bool>
|
||||
<int key="page">1</int>
|
||||
<float key="price">3.5</float>
|
||||
<string key="title">foo</string>
|
||||
</map>
|
||||
</default>
|
||||
</route>
|
||||
</routes>
|
22
Laravel/vendor/symfony/routing/Tests/Fixtures/map_in_list_defaults.xml
vendored
Normal file
22
Laravel/vendor/symfony/routing/Tests/Fixtures/map_in_list_defaults.xml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog" path="/blog">
|
||||
<default key="_controller">
|
||||
<string>AcmeBlogBundle:Blog:index</string>
|
||||
</default>
|
||||
<default key="values">
|
||||
<list>
|
||||
<map>
|
||||
<bool key="public">true</bool>
|
||||
<int key="page">1</int>
|
||||
<float key="price">3.5</float>
|
||||
<string key="title">foo</string>
|
||||
</map>
|
||||
</list>
|
||||
</default>
|
||||
</route>
|
||||
</routes>
|
22
Laravel/vendor/symfony/routing/Tests/Fixtures/map_in_map_defaults.xml
vendored
Normal file
22
Laravel/vendor/symfony/routing/Tests/Fixtures/map_in_map_defaults.xml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog" path="/blog">
|
||||
<default key="_controller">
|
||||
<string>AcmeBlogBundle:Blog:index</string>
|
||||
</default>
|
||||
<default key="values">
|
||||
<map>
|
||||
<map key="map">
|
||||
<bool key="public">true</bool>
|
||||
<int key="page">1</int>
|
||||
<float key="price">3.5</float>
|
||||
<string key="title">foo</string>
|
||||
</map>
|
||||
</map>
|
||||
</default>
|
||||
</route>
|
||||
</routes>
|
22
Laravel/vendor/symfony/routing/Tests/Fixtures/map_null_values.xml
vendored
Normal file
22
Laravel/vendor/symfony/routing/Tests/Fixtures/map_null_values.xml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing
|
||||
http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog" path="/blog">
|
||||
<default key="_controller">
|
||||
<string>AcmeBlogBundle:Blog:index</string>
|
||||
</default>
|
||||
<default key="map">
|
||||
<map>
|
||||
<bool key="boolean" xsi:nil="true" />
|
||||
<int key="integer" xsi:nil="true" />
|
||||
<float key="float" xsi:nil="true" />
|
||||
<string key="string" xsi:nil="1" />
|
||||
<list key="list" xsi:nil="true" />
|
||||
<map key="map" xsi:nil="true" />
|
||||
</map>
|
||||
</default>
|
||||
</route>
|
||||
</routes>
|
8
Laravel/vendor/symfony/routing/Tests/Fixtures/missing_id.xml
vendored
Normal file
8
Laravel/vendor/symfony/routing/Tests/Fixtures/missing_id.xml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route path="/test"></route>
|
||||
</routes>
|
8
Laravel/vendor/symfony/routing/Tests/Fixtures/missing_path.xml
vendored
Normal file
8
Laravel/vendor/symfony/routing/Tests/Fixtures/missing_path.xml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="myroute"></route>
|
||||
</routes>
|
16
Laravel/vendor/symfony/routing/Tests/Fixtures/namespaceprefix.xml
vendored
Normal file
16
Laravel/vendor/symfony/routing/Tests/Fixtures/namespaceprefix.xml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<r:routes xmlns:r="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<r:route id="blog_show" path="/blog/{slug}" host="{_locale}.example.com">
|
||||
<r:default key="_controller">MyBundle:Blog:show</r:default>
|
||||
<requirement xmlns="http://symfony.com/schema/routing" key="slug">\w+</requirement>
|
||||
<r2:requirement xmlns:r2="http://symfony.com/schema/routing" key="_locale">en|fr|de</r2:requirement>
|
||||
<r:option key="compiler_class">RouteCompiler</r:option>
|
||||
<r:default key="page">
|
||||
<r3:int xmlns:r3="http://symfony.com/schema/routing">1</r3:int>
|
||||
</r:default>
|
||||
</r:route>
|
||||
</r:routes>
|
3
Laravel/vendor/symfony/routing/Tests/Fixtures/nonesense_resource_plus_path.yml
vendored
Normal file
3
Laravel/vendor/symfony/routing/Tests/Fixtures/nonesense_resource_plus_path.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
blog_show:
|
||||
resource: validpattern.yml
|
||||
path: /test
|
3
Laravel/vendor/symfony/routing/Tests/Fixtures/nonesense_type_without_resource.yml
vendored
Normal file
3
Laravel/vendor/symfony/routing/Tests/Fixtures/nonesense_type_without_resource.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
blog_show:
|
||||
path: /blog/{slug}
|
||||
type: custom
|
10
Laravel/vendor/symfony/routing/Tests/Fixtures/nonvalid.xml
vendored
Normal file
10
Laravel/vendor/symfony/routing/Tests/Fixtures/nonvalid.xml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<routes xmlns="http://symfony.com/schema/routing"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="blog_show" path="/blog/{slug}">
|
||||
<default key="_controller">MyBundle:Blog:show</default>
|
||||
<!-- </route> -->
|
||||
</routes>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user