0 follower

Final Class Yiisoft\Yii\Console\CommandLoader

InheritanceYiisoft\Yii\Console\CommandLoader
ImplementsSymfony\Component\Console\CommandLoader\CommandLoaderInterface

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( \Psr\Container\ContainerInterface $container, array $commandMap )
$container \Psr\Container\ContainerInterface
$commandMap array

An array with command names as keys and service ids as values.

                public function __construct(private ContainerInterface $container, array $commandMap)
{
    $this->setCommandMap($commandMap);
}

            
get() public method

public \Symfony\Component\Console\Command\Command get ( string $name )
$name string

                public function get(string $name): Command
{
    if (!$this->has($name)) {
        throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
    }
    $commandName = $this->commandMap[$name]['name'];
    $commandAliases = $this->commandMap[$name]['aliases'];
    $commandClass = $this->commandMap[$name]['class'];
    $commandHidden = $this->commandMap[$name]['hidden'];
    $description = $this->getCommandDescription($commandClass);
    if ($description === null) {
        return $this->getCommandInstance($name);
    }
    return new LazyCommand(
        $commandName,
        $commandAliases,
        $description,
        $commandHidden,
        fn () => $this->getCommandInstance($name),
    );
}

            
getNames() public method

public array getNames ( )

                public function getNames(): array
{
    return $this->commandNames;
}

            
has() public method

public boolean has ( string $name )
$name string

                public function has(string $name): bool
{
    return isset($this->commandMap[$name]);
}