Copied!
CloneableFinalInstantiable
Constants
public Symfony\Component\Console\Command\Command::FAILURE = 1
public Symfony\Component\Console\Command\Command::INVALID = 2
public Symfony\Component\Console\Command\Command::SUCCESS = 0
Methods
public __construct(string $name, array $aliases, string $description, bool $isHidden, Closure $commandFactory, ?bool $isEnabled = true)
public addArgument(string $name, ?int $mode = NULL, string $description = '', ?mixed $default = NULL, Closure|array $suggestedValues = []) : static
 
  • param array|callable $suggestedValues The values used for input completion
public addOption(string $name, array|string|?null $shortcut = NULL, ?int $mode = NULL, string $description = '', ?mixed $default = NULL, Closure|array $suggestedValues = []) : static
 
  • param array|callable $suggestedValues The values used for input completion
public addUsage(string $usage) : static
public complete(Symfony\Component\Console\Completion\CompletionInput $input, Symfony\Component\Console\Completion\CompletionSuggestions $suggestions) : void
public Symfony\Component\Console\Command\Command::getAliases() : array
 

Returns the aliases for the command.

public Symfony\Component\Console\Command\Command::getApplication() : ?Symfony\Component\Console\Application
 

Gets the application instance for this command.

public getCommand() : parent
public static Symfony\Component\Console\Command\Command::getDefaultDescription() : ?string
public static Symfony\Component\Console\Command\Command::getDefaultName() : ?string
public getDefinition() : Symfony\Component\Console\Input\InputDefinition
public Symfony\Component\Console\Command\Command::getDescription() : string
 

Returns the description for the command.

public getHelp() : string
public getHelper(string $name) : Symfony\Component\Console\Helper\HelperInterface
public Symfony\Component\Console\Command\Command::getHelperSet() : ?Symfony\Component\Console\Helper\HelperSet
 

Gets the helper set.

public Symfony\Component\Console\Command\Command::getName() : ?string
 

Returns the command name.

public getNativeDefinition() : Symfony\Component\Console\Input\InputDefinition
public getProcessedHelp() : string
public getSynopsis(bool $short = false) : string
public getUsages() : array
public ignoreValidationErrors() : void
public isEnabled() : bool
public Symfony\Component\Console\Command\Command::isHidden() : bool
 
  • return bool whether the command should be publicly shown or not
public mergeApplicationDefinition(bool $mergeArgs = true) : void
 
  • internal
public run(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output) : int
public Symfony\Component\Console\Command\Command::setAliases(iterable $aliases) : static
 

Sets the aliases for the command.

  • param string[] $aliases An array of aliases for the command
  • return $this
  • throws \InvalidArgumentException When an alias is invalid
public setApplication(?Symfony\Component\Console\Application $application) : void
public setCode(callable $code) : static
public setDefinition(Symfony\Component\Console\Input\InputDefinition|array $definition) : static
public Symfony\Component\Console\Command\Command::setDescription(string $description) : static
 

Sets the description for the command.

  • return $this
public setHelp(string $help) : static
public setHelperSet(Symfony\Component\Console\Helper\HelperSet $helperSet) : void
public Symfony\Component\Console\Command\Command::setHidden(bool $hidden = true) : static
 
  • param bool $hidden Whether or not the command should be hidden from the list of commands
  • return $this
public Symfony\Component\Console\Command\Command::setName(string $name) : static
 

Sets the name of the command.

This method can set both the namespace and the name if you separate them by a colon (:)

$command->setName('foo:bar');
  • return $this
  • throws \InvalidArgumentException When the name is invalid
public setProcessTitle(string $title) : static
Methods
protected Symfony\Component\Console\Command\Command::configure()
 

Configures the current command.

  • return void
protected Symfony\Component\Console\Command\Command::execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output) : int
 

Executes the current command.

This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.

  • return int 0 if everything went fine, or an exit code
  • throws \LogicException When this abstract method is not implemented
  • see \setCode()
protected Symfony\Component\Console\Command\Command::initialize(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output)
 

Initializes the command after the input has been bound and before the input is validated.

This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.

  • see \InputInterface::bind()
  • see \InputInterface::validate()
  • return void
protected Symfony\Component\Console\Command\Command::interact(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output)
 

Interacts with the user.

This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.

  • return void
Properties
private Closure|Symfony\Component\Console\Command\Command $command
private ?bool $isEnabled
Methods
public static Symfony\Component\Console\Command\Command::getDefaultDescription() : ?string
public static Symfony\Component\Console\Command\Command::getDefaultName() : ?string
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration