Method | Description | |
---|---|---|
__construct ( string $name = 'UNKNOWN', string $version = 'UNKNOWN' ) | ||
add ( |
Adds a command object. | |
addCommands ( array $commands ) | Adds an array of command objects. | |
all ( string $namespace = null ) : |
Gets the commands (registered in the given namespace if provided). | |
areExceptionsCaught ( ) : boolean | Gets whether to catch exceptions or not during commands execution. | |
doRun ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : integer | Runs the current application. | |
extractNamespace ( string $name, string $limit = null ) : string | Returns the namespace part of the command name. | |
find ( string $name ) : |
Finds a command by name or alias. | |
findNamespace ( string $namespace ) : string | Finds a registered namespace by a name or an abbreviation. | |
get ( string $name ) : |
Returns a registered command by name or alias. | |
getAbbreviations ( array $names ) : array | Returns an array of possible abbreviations given a set of names. | |
getDefinition ( ) : Symfony\Component\Console\Input\InputDefinition | Gets the InputDefinition related to this Application. | |
getHelp ( ) : string | Gets the help message. | |
getHelperSet ( ) : Symfony\Component\Console\Helper\HelperSet | Get the helper set associated with the command. | |
getLongVersion ( ) : string | Returns the long version of the application. | |
getName ( ) : string | Gets the name of the application. | |
getNamespaces ( ) : string[] | Returns an array of all unique namespaces used by currently registered commands. | |
getTerminalDimensions ( ) : array | Tries to figure out the terminal dimensions based on the current environment. | |
getVersion ( ) : string | Gets the application version. | |
has ( string $name ) : boolean | Returns true if the command exists, false otherwise. | |
isAutoExitEnabled ( ) : boolean | Gets whether to automatically exit after a command execution or not. | |
register ( string $name ) : |
Registers a new command. | |
renderException ( Exception $e, Symfony\Component\Console\Output\OutputInterface $output ) | Renders a caught exception. | |
run ( Symfony\Component\Console\Input\InputInterface $input = null, Symfony\Component\Console\Output\OutputInterface $output = null ) : integer | Runs the current application. | |
setAutoExit ( boolean $boolean ) | Sets whether to automatically exit after a command execution or not. | |
setCatchExceptions ( boolean $boolean ) | Sets whether to catch exceptions or not during commands execution. | |
setDefaultCommand ( string $commandName, boolean $isSingleCommand = false ) : self | Sets the default Command name. | |
setDefinition ( Symfony\Component\Console\Input\InputDefinition $definition ) | Set an input definition to be used with this application. | |
setDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher ) | ||
setHelperSet ( Symfony\Component\Console\Helper\HelperSet $helperSet ) | Set a helper set to be used with the command. | |
setName ( string $name ) | Sets the application name. | |
setTerminalDimensions ( integer $width, integer $height ) : |
Sets terminal dimensions. | |
setVersion ( string $version ) | Sets the application version. |
Method | Description | |
---|---|---|
configureIO ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) | Configures the input and output instances based on the user arguments and options. | |
doRunCommand ( |
Runs the current command. | |
getCommandName ( Symfony\Component\Console\Input\InputInterface $input ) : string | Gets the name of the command based on input. | |
getDefaultCommands ( ) : |
Gets the default commands that should always be available. | |
getDefaultHelperSet ( ) : Symfony\Component\Console\Helper\HelperSet | Gets the default helper set with the helpers that should always be available. | |
getDefaultInputDefinition ( ) : Symfony\Component\Console\Input\InputDefinition | Gets the default input definition. | |
getTerminalHeight ( ) : integer | null | Tries to figure out the terminal height in which this application runs. | |
getTerminalWidth ( ) : integer | null | Tries to figure out the terminal width in which this application runs. |
Method | Description | |
---|---|---|
extractAllNamespaces ( string $name ) : string[] | Returns all namespaces of the command name. | |
findAlternatives ( string $name, array | Traversable $collection ) : string[] | Finds alternative of $name among $collection, if nothing is found in $collection, try in $abbrevs. | |
getAbbreviationSuggestions ( array $abbrevs ) : string | Returns abbreviated suggestions in string format. | |
splitStringByWidth ( $string, $width ) | ||
stringWidth ( $string ) |
public __construct ( string $name = 'UNKNOWN', string $version = 'UNKNOWN' ) | ||
$name | string | The name of the application |
$version | string | The version of the application |
public addCommands ( array $commands ) | ||
$commands | array | An array of commands |
public areExceptionsCaught ( ) : boolean | ||
return | boolean | Whether to catch exceptions or not during commands execution |
protected configureIO ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) | ||
$input | Symfony\Component\Console\Input\InputInterface | An InputInterface instance |
$output | Symfony\Component\Console\Output\OutputInterface | An OutputInterface instance |
public doRun ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : integer | ||
$input | Symfony\Component\Console\Input\InputInterface | An Input instance |
$output | Symfony\Component\Console\Output\OutputInterface | An Output instance |
return | integer | 0 if everything went fine, or an error code |
protected doRunCommand ( |
||
$command | A Command instance | |
$input | Symfony\Component\Console\Input\InputInterface | An Input instance |
$output | Symfony\Component\Console\Output\OutputInterface | An Output instance |
return | integer | 0 if everything went fine, or an error code |
public findNamespace ( string $namespace ) : string | ||
$namespace | string | A namespace or abbreviation to search for |
return | string | A registered namespace |
public static getAbbreviations ( array $names ) : array | ||
$names | array | An array of names |
return | array | An array of abbreviations |
protected getCommandName ( Symfony\Component\Console\Input\InputInterface $input ) : string | ||
$input | Symfony\Component\Console\Input\InputInterface | The input interface |
return | string | The command name |
protected getDefaultCommands ( ) : |
||
return | An array of default Command instances |
protected getDefaultHelperSet ( ) : Symfony\Component\Console\Helper\HelperSet | ||
return | Symfony\Component\Console\Helper\HelperSet | A HelperSet instance |
protected getDefaultInputDefinition ( ) : Symfony\Component\Console\Input\InputDefinition | ||
return | Symfony\Component\Console\Input\InputDefinition | An InputDefinition instance |
public getDefinition ( ) : Symfony\Component\Console\Input\InputDefinition | ||
return | Symfony\Component\Console\Input\InputDefinition | The InputDefinition instance |
public getHelperSet ( ) : Symfony\Component\Console\Helper\HelperSet | ||
return | Symfony\Component\Console\Helper\HelperSet | The HelperSet instance associated with this command |
public getLongVersion ( ) : string | ||
return | string | The long application version |
public getNamespaces ( ) : string[] | ||
return | string[] | An array of namespaces |
public getTerminalDimensions ( ) : array | ||
return | array | Array containing width and height |
protected getTerminalHeight ( ) : integer | null | ||
return | integer | null |
protected getTerminalWidth ( ) : integer | null | ||
return | integer | null |
public getVersion ( ) : string | ||
return | string | The application version |
public isAutoExitEnabled ( ) : boolean | ||
return | boolean | Whether to automatically exit after a command execution or not |
public renderException ( Exception $e, Symfony\Component\Console\Output\OutputInterface $output ) | ||
$e | Exception | An exception instance |
$output | Symfony\Component\Console\Output\OutputInterface | An OutputInterface instance |
public run ( Symfony\Component\Console\Input\InputInterface $input = null, Symfony\Component\Console\Output\OutputInterface $output = null ) : integer | ||
$input | Symfony\Component\Console\Input\InputInterface | An Input instance |
$output | Symfony\Component\Console\Output\OutputInterface | An Output instance |
return | integer | 0 if everything went fine, or an error code |
public setAutoExit ( boolean $boolean ) | ||
$boolean | boolean | Whether to automatically exit after a command execution or not |
public setCatchExceptions ( boolean $boolean ) | ||
$boolean | boolean | Whether to catch exceptions or not during commands execution |
public setDefaultCommand ( string $commandName, boolean $isSingleCommand = false ) : self | ||
$commandName | string | The Command name |
$isSingleCommand | boolean | Set to true if there is only one command in this application |
return | self |
public setDefinition ( Symfony\Component\Console\Input\InputDefinition $definition ) | ||
$definition | Symfony\Component\Console\Input\InputDefinition | The input definition |
public setDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher ) | ||
$dispatcher | Symfony\Component\EventDispatcher\EventDispatcherInterface |
public setHelperSet ( Symfony\Component\Console\Helper\HelperSet $helperSet ) | ||
$helperSet | Symfony\Component\Console\Helper\HelperSet | The helper set |
public setTerminalDimensions ( integer $width, integer $height ) : |
||
$width | integer | The width |
$height | integer | The height |
return | The current application |
public setVersion ( string $version ) | ||
$version | string | The application version |