mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-10 17:03:52 +09:00
Updates to vendors etc
This commit is contained in:
@@ -21,14 +21,16 @@ use Symfony\Component\Routing\RequestContext;
|
||||
class CompiledUrlGenerator extends UrlGenerator
|
||||
{
|
||||
private array $compiledRoutes = [];
|
||||
private ?string $defaultLocale;
|
||||
|
||||
public function __construct(array $compiledRoutes, RequestContext $context, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
|
||||
{
|
||||
public function __construct(
|
||||
array $compiledRoutes,
|
||||
RequestContext $context,
|
||||
?LoggerInterface $logger = null,
|
||||
private ?string $defaultLocale = null,
|
||||
) {
|
||||
$this->compiledRoutes = $compiledRoutes;
|
||||
$this->context = $context;
|
||||
$this->logger = $logger;
|
||||
$this->defaultLocale = $defaultLocale;
|
||||
}
|
||||
|
||||
public function generate(string $name, array $parameters = [], int $referenceType = self::ABSOLUTE_PATH): string
|
||||
@@ -47,7 +49,7 @@ class CompiledUrlGenerator extends UrlGenerator
|
||||
}
|
||||
|
||||
if (!isset($this->compiledRoutes[$name])) {
|
||||
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
|
||||
throw new RouteNotFoundException(\sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
|
||||
}
|
||||
|
||||
[$variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes, $deprecations] = $this->compiledRoutes[$name] + [6 => []];
|
||||
|
||||
@@ -40,10 +40,8 @@ interface ConfigurableRequirementsInterface
|
||||
/**
|
||||
* Enables or disables the exception on incorrect parameters.
|
||||
* Passing null will deactivate the requirements check completely.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setStrictRequirements(?bool $enabled);
|
||||
public function setStrictRequirements(?bool $enabled): void;
|
||||
|
||||
/**
|
||||
* Returns whether to throw an exception on incorrect parameters.
|
||||
|
||||
@@ -69,7 +69,7 @@ class CompiledUrlGeneratorDumper extends GeneratorDumper
|
||||
}
|
||||
|
||||
if (null === $target = $routes->get($currentId)) {
|
||||
throw new RouteNotFoundException(sprintf('Target route "%s" for alias "%s" does not exist.', $currentId, $name));
|
||||
throw new RouteNotFoundException(\sprintf('Target route "%s" for alias "%s" does not exist.', $currentId, $name));
|
||||
}
|
||||
|
||||
$compiledTarget = $target->compile();
|
||||
@@ -109,11 +109,11 @@ EOF;
|
||||
{
|
||||
$routes = '';
|
||||
foreach ($this->getCompiledRoutes() as $name => $properties) {
|
||||
$routes .= sprintf("\n '%s' => %s,", $name, CompiledUrlMatcherDumper::export($properties));
|
||||
$routes .= \sprintf("\n '%s' => %s,", $name, CompiledUrlMatcherDumper::export($properties));
|
||||
}
|
||||
|
||||
foreach ($this->getCompiledAliases() as $alias => $properties) {
|
||||
$routes .= sprintf("\n '%s' => %s,", $alias, CompiledUrlMatcherDumper::export($properties));
|
||||
$routes .= \sprintf("\n '%s' => %s,", $alias, CompiledUrlMatcherDumper::export($properties));
|
||||
}
|
||||
|
||||
return $routes;
|
||||
|
||||
@@ -20,11 +20,9 @@ use Symfony\Component\Routing\RouteCollection;
|
||||
*/
|
||||
abstract class GeneratorDumper implements GeneratorDumperInterface
|
||||
{
|
||||
private RouteCollection $routes;
|
||||
|
||||
public function __construct(RouteCollection $routes)
|
||||
{
|
||||
$this->routes = $routes;
|
||||
public function __construct(
|
||||
private RouteCollection $routes,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getRoutes(): RouteCollection
|
||||
|
||||
@@ -42,17 +42,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
||||
'%2A' => '*',
|
||||
];
|
||||
|
||||
protected $routes;
|
||||
protected $context;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
protected $strictRequirements = true;
|
||||
|
||||
protected $logger;
|
||||
|
||||
private ?string $defaultLocale;
|
||||
protected ?bool $strictRequirements = true;
|
||||
|
||||
/**
|
||||
* This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL.
|
||||
@@ -62,7 +52,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
||||
* "?" and "#" (would be interpreted wrongly as query and fragment identifier),
|
||||
* "'" and """ (are used as delimiters in HTML).
|
||||
*/
|
||||
protected $decodedChars = [
|
||||
protected array $decodedChars = [
|
||||
// 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
|
||||
@@ -83,18 +73,15 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
||||
'%7C' => '|',
|
||||
];
|
||||
|
||||
public function __construct(RouteCollection $routes, RequestContext $context, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
|
||||
{
|
||||
$this->routes = $routes;
|
||||
$this->context = $context;
|
||||
$this->logger = $logger;
|
||||
$this->defaultLocale = $defaultLocale;
|
||||
public function __construct(
|
||||
protected RouteCollection $routes,
|
||||
protected RequestContext $context,
|
||||
protected ?LoggerInterface $logger = null,
|
||||
private ?string $defaultLocale = null,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setContext(RequestContext $context)
|
||||
public function setContext(RequestContext $context): void
|
||||
{
|
||||
$this->context = $context;
|
||||
}
|
||||
@@ -104,10 +91,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setStrictRequirements(?bool $enabled)
|
||||
public function setStrictRequirements(?bool $enabled): void
|
||||
{
|
||||
$this->strictRequirements = $enabled;
|
||||
}
|
||||
@@ -131,7 +115,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
||||
}
|
||||
|
||||
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));
|
||||
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
|
||||
@@ -282,7 +266,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
||||
if ($vars = get_object_vars($v)) {
|
||||
array_walk_recursive($vars, $caster);
|
||||
$v = $vars;
|
||||
} elseif (method_exists($v, '__toString')) {
|
||||
} elseif ($v instanceof \Stringable) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user