updated backend

This commit is contained in:
Torsten 2020-01-17 10:58:01 +01:00
parent 1fea0f4fe7
commit 11521c2339
3459 changed files with 72735 additions and 168535 deletions

View file

@ -28,12 +28,12 @@ class RouteCollection implements \IteratorAggregate, \Countable
/**
* @var Route[]
*/
private $routes = array();
private $routes = [];
/**
* @var array
*/
private $resources = array();
private $resources = [];
public function __clone()
{
@ -69,8 +69,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
/**
* Adds a route.
*
* @param string $name The route name
* @param Route $route A Route instance
* @param string $name The route name
*/
public function add($name, Route $route)
{
@ -138,8 +137,12 @@ class RouteCollection implements \IteratorAggregate, \Countable
* @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())
public function addPrefix($prefix, array $defaults = [], array $requirements = [])
{
if (null === $prefix) {
@trigger_error(sprintf('Passing null as $prefix to %s is deprecated in Symfony 4.4 and will trigger a TypeError in 5.0.', __METHOD__), E_USER_DEPRECATED);
}
$prefix = trim(trim($prefix), '/');
if ('' === $prefix) {
@ -153,6 +156,23 @@ class RouteCollection implements \IteratorAggregate, \Countable
}
}
/**
* Adds a prefix to the name of all the routes within in the collection.
*/
public function addNamePrefix(string $prefix)
{
$prefixedRoutes = [];
foreach ($this->routes as $name => $route) {
$prefixedRoutes[$prefix.$name] = $route;
if (null !== $name = $route->getDefault('_canonical_route')) {
$route->setDefault('_canonical_route', $prefix.$name);
}
}
$this->routes = $prefixedRoutes;
}
/**
* Sets the host pattern on all routes.
*
@ -160,7 +180,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
* @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())
public function setHost($pattern, array $defaults = [], array $requirements = [])
{
foreach ($this->routes as $route) {
$route->setHost($pattern);
@ -219,8 +239,6 @@ class RouteCollection implements \IteratorAggregate, \Countable
* 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)
{