PHP Interface Webmozart\Console\Api\Application\Application

Since: 1.0
Author: Bernhard Schussek ([email protected])
Show file Open project: webmozart/console Interface Usage Examples

Public Methods

Method Description
getCommand ( string $name ) : Command Returns the command for a given name.
getCommands ( ) : CommandCollection Returns all registered commands.
getConfig ( ) : ApplicationConfig Returns the application configuration.
getDefaultCommands ( ) : CommandCollection Returns the commands that should be executed if no explicit command is passed.
getGlobalArgsFormat ( ) : ArgsFormat Returns the global arguments format of the application.
getNamedCommands ( ) : CommandCollection Returns the commands that are not anonymous.
hasCommand ( string $name ) : boolean Returns whether the application has a command with a given name.
hasCommands ( ) : boolean Returns whether the application has any registered commands.
hasDefaultCommands ( ) : boolean Returns whether the application has any default commands.
hasNamedCommands ( ) : boolean Returns whether the application has any commands that are not anonymous.
resolveCommand ( Webmozart\Console\Api\Args\RawArgs $args ) : ResolvedCommand Returns the command to execute for the given console arguments.
run ( Webmozart\Console\Api\Args\RawArgs $args = null, Webmozart\Console\Api\IO\InputStream $inputStream = null, Webmozart\Console\Api\IO\OutputStream $outputStream = null, Webmozart\Console\Api\IO\OutputStream $errorStream = null ) : integer Executes the command.

Method Details

getCommand() public method

Returns the command for a given name.
public getCommand ( string $name ) : Command
$name string The name of the command.
return Webmozart\Console\Api\Command\Command The command.

getCommands() public method

Returns all registered commands.
public getCommands ( ) : CommandCollection
return Webmozart\Console\Api\Command\CommandCollection The commands.

getConfig() public method

Returns the application configuration.
public getConfig ( ) : ApplicationConfig
return Webmozart\Console\Api\Config\ApplicationConfig The application configuration.

getDefaultCommands() public method

Returns the commands that should be executed if no explicit command is passed.
public getDefaultCommands ( ) : CommandCollection
return Webmozart\Console\Api\Command\CommandCollection The default commands.

getGlobalArgsFormat() public method

Returns the global arguments format of the application.
public getGlobalArgsFormat ( ) : ArgsFormat
return Webmozart\Console\Api\Args\Format\ArgsFormat The global arguments format.

getNamedCommands() public method

Returns the commands that are not anonymous.
public getNamedCommands ( ) : CommandCollection
return Webmozart\Console\Api\Command\CommandCollection The named commands.

hasCommand() public method

Returns whether the application has a command with a given name.
public hasCommand ( string $name ) : boolean
$name string The name of the command.
return boolean Returns `true` if the command with the given name exists and `false` otherwise.

hasCommands() public method

Returns whether the application has any registered commands.
public hasCommands ( ) : boolean
return boolean Returns `true` if the application has any commands and `false` otherwise.

hasDefaultCommands() public method

Returns whether the application has any default commands.
See also: getDefaultCommands()
public hasDefaultCommands ( ) : boolean
return boolean Returns `true` if the application has default commands and `false` otherwise.

hasNamedCommands() public method

Returns whether the application has any commands that are not anonymous.
See also: getNamedCommands()
public hasNamedCommands ( ) : boolean
return boolean Returns `true` if the application has named commands and `false` otherwise.

resolveCommand() public method

Returns the command to execute for the given console arguments.
public resolveCommand ( Webmozart\Console\Api\Args\RawArgs $args ) : ResolvedCommand
$args Webmozart\Console\Api\Args\RawArgs The console arguments.
return Webmozart\Console\Api\Resolver\ResolvedCommand The command to execute.

run() public method

Executes the command.
public run ( Webmozart\Console\Api\Args\RawArgs $args = null, Webmozart\Console\Api\IO\InputStream $inputStream = null, Webmozart\Console\Api\IO\OutputStream $outputStream = null, Webmozart\Console\Api\IO\OutputStream $errorStream = null ) : integer
$args Webmozart\Console\Api\Args\RawArgs The console arguments. If not given, the arguments passed to the PHP process are used.
$inputStream Webmozart\Console\Api\IO\InputStream The standard input. If not given, the application reads from the standard input of the PHP process.
$outputStream Webmozart\Console\Api\IO\OutputStream The standard output. If not given, the application prints to the standard output of the PHP process.
$errorStream Webmozart\Console\Api\IO\OutputStream The error output. If not given, the application prints to the error output of the PHP process.
return integer The exit status.