mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-10 00:43:50 +09:00
Updates to vendors etc
This commit is contained in:
@@ -22,22 +22,19 @@ use Symfony\Component\Console\Exception\CommandNotFoundException;
|
||||
*/
|
||||
class ContainerCommandLoader implements CommandLoaderInterface
|
||||
{
|
||||
private ContainerInterface $container;
|
||||
private array $commandMap;
|
||||
|
||||
/**
|
||||
* @param array $commandMap An array with command names as keys and service ids as values
|
||||
*/
|
||||
public function __construct(ContainerInterface $container, array $commandMap)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->commandMap = $commandMap;
|
||||
public function __construct(
|
||||
private ContainerInterface $container,
|
||||
private array $commandMap,
|
||||
) {
|
||||
}
|
||||
|
||||
public function get(string $name): Command
|
||||
{
|
||||
if (!$this->has($name)) {
|
||||
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
|
||||
throw new CommandNotFoundException(\sprintf('Command "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
return $this->container->get($this->commandMap[$name]);
|
||||
|
||||
@@ -21,14 +21,12 @@ use Symfony\Component\Console\Exception\CommandNotFoundException;
|
||||
*/
|
||||
class FactoryCommandLoader implements CommandLoaderInterface
|
||||
{
|
||||
private array $factories;
|
||||
|
||||
/**
|
||||
* @param callable[] $factories Indexed by command names
|
||||
*/
|
||||
public function __construct(array $factories)
|
||||
{
|
||||
$this->factories = $factories;
|
||||
public function __construct(
|
||||
private array $factories,
|
||||
) {
|
||||
}
|
||||
|
||||
public function has(string $name): bool
|
||||
@@ -39,7 +37,7 @@ class FactoryCommandLoader implements CommandLoaderInterface
|
||||
public function get(string $name): Command
|
||||
{
|
||||
if (!isset($this->factories[$name])) {
|
||||
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
|
||||
throw new CommandNotFoundException(\sprintf('Command "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
$factory = $this->factories[$name];
|
||||
|
||||
Reference in New Issue
Block a user