Back to WritableContainerLoader class

Method get

public \Joomla\Console\Command\AbstractCommand
get
(string $name)
Loads a command.
Parameters
  • string $name The command to load.
Returns
  • \Joomla\Console\Command\AbstractCommand
Since
  • 4.0.0
-
  • \Symfony\Component\Console\Exception\CommandNotFoundException

Method get - Source code

/**
 * Loads a command.
 *
 * @param   string  $name  The command to load.
 *
 * @return  AbstractCommand
 *
 * @since   4.0.0
 * @throws  CommandNotFoundException
 */
public function get(string $name) : AbstractCommand
{
    if (!$this->has($name)) {
        throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
    }
    return $this->container->get($this->commandMap[$name]);
}