updated backend
This commit is contained in:
parent
1fea0f4fe7
commit
11521c2339
3459 changed files with 72735 additions and 168535 deletions
86
pfosten/vendor/symfony/routing/Route.php
vendored
86
pfosten/vendor/symfony/routing/Route.php
vendored
|
|
@ -21,15 +21,15 @@ class Route implements \Serializable
|
|||
{
|
||||
private $path = '/';
|
||||
private $host = '';
|
||||
private $schemes = array();
|
||||
private $methods = array();
|
||||
private $defaults = array();
|
||||
private $requirements = array();
|
||||
private $options = array();
|
||||
private $schemes = [];
|
||||
private $methods = [];
|
||||
private $defaults = [];
|
||||
private $requirements = [];
|
||||
private $options = [];
|
||||
private $condition = '';
|
||||
|
||||
/**
|
||||
* @var null|CompiledRoute
|
||||
* @var CompiledRoute|null
|
||||
*/
|
||||
private $compiled;
|
||||
|
||||
|
|
@ -45,16 +45,16 @@ class Route implements \Serializable
|
|||
* @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|null $host The host pattern to match
|
||||
* @param string|string[] $schemes A required URI scheme or an array of restricted schemes
|
||||
* @param string|string[] $methods A required HTTP method or an array of restricted methods
|
||||
* @param string $condition A condition that should evaluate to true for the route to match
|
||||
* @param string|null $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 = '')
|
||||
public function __construct(string $path, array $defaults = [], array $requirements = [], array $options = [], ?string $host = '', $schemes = [], $methods = [], ?string $condition = '')
|
||||
{
|
||||
$this->setPath($path);
|
||||
$this->setDefaults($defaults);
|
||||
$this->setRequirements($requirements);
|
||||
$this->addDefaults($defaults);
|
||||
$this->addRequirements($requirements);
|
||||
$this->setOptions($options);
|
||||
$this->setHost($host);
|
||||
$this->setSchemes($schemes);
|
||||
|
|
@ -62,12 +62,9 @@ class Route implements \Serializable
|
|||
$this->setCondition($condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function serialize()
|
||||
public function __serialize(): array
|
||||
{
|
||||
return serialize(array(
|
||||
return [
|
||||
'path' => $this->path,
|
||||
'host' => $this->host,
|
||||
'defaults' => $this->defaults,
|
||||
|
|
@ -77,15 +74,22 @@ class Route implements \Serializable
|
|||
'methods' => $this->methods,
|
||||
'condition' => $this->condition,
|
||||
'compiled' => $this->compiled,
|
||||
));
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return string
|
||||
*
|
||||
* @internal since Symfony 4.3
|
||||
* @final since Symfony 4.3
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
public function serialize()
|
||||
{
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
public function __unserialize(array $data): void
|
||||
{
|
||||
$data = unserialize($serialized);
|
||||
$this->path = $data['path'];
|
||||
$this->host = $data['host'];
|
||||
$this->defaults = $data['defaults'];
|
||||
|
|
@ -102,6 +106,15 @@ class Route implements \Serializable
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal since Symfony 4.3
|
||||
* @final since Symfony 4.3
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$this->__unserialize(unserialize($serialized));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pattern for the path.
|
||||
*
|
||||
|
|
@ -123,6 +136,19 @@ class Route implements \Serializable
|
|||
*/
|
||||
public function setPath($pattern)
|
||||
{
|
||||
if (false !== strpbrk($pattern, '?<')) {
|
||||
$pattern = preg_replace_callback('#\{(\w++)(<.*?>)?(\?[^\}]*+)?\}#', function ($m) {
|
||||
if (isset($m[3][0])) {
|
||||
$this->setDefault($m[1], '?' !== $m[3] ? substr($m[3], 1) : null);
|
||||
}
|
||||
if (isset($m[2][0])) {
|
||||
$this->setRequirement($m[1], substr($m[2], 1, -1));
|
||||
}
|
||||
|
||||
return '{'.$m[1].'}';
|
||||
}, $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), '/');
|
||||
|
|
@ -243,15 +269,13 @@ class Route implements \Serializable
|
|||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param array $options The options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
{
|
||||
$this->options = array(
|
||||
$this->options = [
|
||||
'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler',
|
||||
);
|
||||
];
|
||||
|
||||
return $this->addOptions($options);
|
||||
}
|
||||
|
|
@ -261,8 +285,6 @@ class Route implements \Serializable
|
|||
*
|
||||
* This method implements a fluent interface.
|
||||
*
|
||||
* @param array $options The options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addOptions(array $options)
|
||||
|
|
@ -314,7 +336,7 @@ class Route implements \Serializable
|
|||
*/
|
||||
public function hasOption($name)
|
||||
{
|
||||
return array_key_exists($name, $this->options);
|
||||
return \array_key_exists($name, $this->options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -338,7 +360,7 @@ class Route implements \Serializable
|
|||
*/
|
||||
public function setDefaults(array $defaults)
|
||||
{
|
||||
$this->defaults = array();
|
||||
$this->defaults = [];
|
||||
|
||||
return $this->addDefaults($defaults);
|
||||
}
|
||||
|
|
@ -383,7 +405,7 @@ class Route implements \Serializable
|
|||
*/
|
||||
public function hasDefault($name)
|
||||
{
|
||||
return array_key_exists($name, $this->defaults);
|
||||
return \array_key_exists($name, $this->defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -423,7 +445,7 @@ class Route implements \Serializable
|
|||
*/
|
||||
public function setRequirements(array $requirements)
|
||||
{
|
||||
$this->requirements = array();
|
||||
$this->requirements = [];
|
||||
|
||||
return $this->addRequirements($requirements);
|
||||
}
|
||||
|
|
@ -468,7 +490,7 @@ class Route implements \Serializable
|
|||
*/
|
||||
public function hasRequirement($key)
|
||||
{
|
||||
return array_key_exists($key, $this->requirements);
|
||||
return \array_key_exists($key, $this->requirements);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -535,7 +557,7 @@ class Route implements \Serializable
|
|||
return $this->compiled = $class::compile($this);
|
||||
}
|
||||
|
||||
private function sanitizeRequirement($key, $regex)
|
||||
private function sanitizeRequirement(string $key, $regex)
|
||||
{
|
||||
if (!\is_string($regex)) {
|
||||
throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string.', $key));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue