WritableContainerLoader

Implements \Joomla\CMS\Console\Loader\WritableLoaderInterface

PSR-11 compatible writable command loader.

final
since

4.0.0

Methods

__construct

Constructor.

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

4.0.0

Arguments

$container

\Psr\Container\ContainerInterfaceA container from which to load command services.

$commandMap

arrayAn array with command names as keys and service IDs as values.

add

Adds a command to the loader.

add(string $commandName, string $className) : void
since

4.0.0

Arguments

$commandName

stringThe name of the command to load.

$className

stringThe fully qualified class name of the command.

get

Loads a command.

get(string $name) : \Joomla\Console\Command\AbstractCommand
since

4.0.0

throws

\Symfony\Component\Console\Exception\CommandNotFoundException

Arguments

$name

stringThe command to load.

Response

\Joomla\Console\Command\AbstractCommand

getNames

Get the names of the registered commands.

getNames() : array<mixed,string>
since

4.0.0

Response

array<mixed,string>

has

Checks if a command exists.

has(string $name) : boolean
since

4.0.0

Arguments

$name

stringThe command to check.

Response

boolean

Properties

container

The service container.

since

4.0.0

Type(s)

\Psr\Container\ContainerInterface

commandMap

The command name to service ID map.

since

4.0.0

Type(s)

array<mixed,string>