CommandManager
class CommandManager (View source)
A helper for CLI Commands
Properties
protected Command[] | $availableCommands | ||
protected array | $shortCommandIdentifiers | ||
protected Bootstrap | $bootstrap | ||
protected ObjectManagerInterface | $objectManager |
Methods
Returns an array of all commands
Returns a Command that matches the given identifier.
Returns an array of Commands that matches the given identifier.
Returns the shortest, non-ambiguous command identifier for the given command
Returns an array that contains all available command identifiers and their shortest non-ambiguous alias
Returns true if the specified command identifier matches the identifier of the specified command.
Get the possible parameters for the command specified by CommandController and method name.
Details
void
injectObjectManager(ObjectManagerInterface $objectManager)
No description
void
injectBootstrap(Bootstrap $bootstrap)
No description
array
getAvailableCommands()
Returns an array of all commands
Command
getCommandByIdentifier(string $commandIdentifier)
Returns a Command that matches the given identifier.
If no Command could be found a CommandNotFoundException is thrown If more than one Command matches an AmbiguousCommandIdentifierException is thrown that contains the matched Commands
array
getCommandsByIdentifier(string $commandIdentifier)
Returns an array of Commands that matches the given identifier.
If no Command could be found, an empty array is returned
string
getShortestIdentifierForCommand(Command $command)
Returns the shortest, non-ambiguous command identifier for the given command
protected array
getShortCommandIdentifiers()
Returns an array that contains all available command identifiers and their shortest non-ambiguous alias
protected bool
commandMatchesIdentifier(Command $command, string $commandIdentifier)
Returns true if the specified command identifier matches the identifier of the specified command.
This is the case, if
- the identifiers are the same
- if at least the last two command parts match (case sensitive)
- if only the package key is specified and matches the commands package key (case insensitive) or
- if the commandIdentifier matches the second command part (CommandController name, case insensitive) The first part (package key) can be reduced to the last subpackage, as long as the result is unambiguous.
array
getCommandMethodParameters(string $controllerObjectName, string $commandMethodName)
Get the possible parameters for the command specified by CommandController and method name.
static array
getCommandControllerMethodArguments(ObjectManagerInterface $objectManager)
No description