update patch 1

This commit is contained in:
fiqhpratama
2024-12-02 01:18:34 +07:00
parent 453d9bb470
commit 25026b0a85
3380 changed files with 103529 additions and 363623 deletions
+11 -13
View File
@@ -40,12 +40,8 @@ class Router implements RouterInterface, RequestMatcherInterface
protected UrlMatcherInterface|RequestMatcherInterface $matcher;
protected UrlGeneratorInterface $generator;
protected RequestContext $context;
protected LoaderInterface $loader;
protected RouteCollection $collection;
protected mixed $resource;
protected array $options = [];
protected ?LoggerInterface $logger;
protected ?string $defaultLocale;
private ConfigCacheFactoryInterface $configCacheFactory;
@@ -56,14 +52,16 @@ class Router implements RouterInterface, RequestMatcherInterface
private static ?array $cache = [];
public function __construct(LoaderInterface $loader, mixed $resource, array $options = [], ?RequestContext $context = null, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
{
$this->loader = $loader;
$this->resource = $resource;
$this->logger = $logger;
public function __construct(
protected LoaderInterface $loader,
protected mixed $resource,
array $options = [],
?RequestContext $context = null,
protected ?LoggerInterface $logger = null,
protected ?string $defaultLocale = null,
) {
$this->context = $context ?? new RequestContext();
$this->setOptions($options);
$this->defaultLocale = $defaultLocale;
}
/**
@@ -107,7 +105,7 @@ class Router implements RouterInterface, RequestMatcherInterface
}
if ($invalid) {
throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('", "', $invalid)));
throw new \InvalidArgumentException(\sprintf('The Router does not support the following options: "%s".', implode('", "', $invalid)));
}
}
@@ -119,7 +117,7 @@ class Router implements RouterInterface, RequestMatcherInterface
public function setOption(string $key, mixed $value): void
{
if (!\array_key_exists($key, $this->options)) {
throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key));
throw new \InvalidArgumentException(\sprintf('The Router does not support the "%s" option.', $key));
}
$this->options[$key] = $value;
@@ -133,7 +131,7 @@ class Router implements RouterInterface, RequestMatcherInterface
public function getOption(string $key): mixed
{
if (!\array_key_exists($key, $this->options)) {
throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key));
throw new \InvalidArgumentException(\sprintf('The Router does not support the "%s" option.', $key));
}
return $this->options[$key];