Overview

Namespaces

  • Webmozart
    • Console
      • Adapter
      • Api
        • Application
        • Args
          • Format
        • Command
        • Config
        • Event
        • Formatter
        • IO
        • Resolver
      • Args
      • Config
      • Formatter
      • Handler
        • Help
      • IO
        • InputStream
        • OutputStream
      • Process
      • Resolver
      • UI
        • Alignment
        • Component
        • Help
        • Layout
        • Style
      • Util

Classes

  • ConsoleApplication
  • Overview
  • Namespace
  • Class

Class ConsoleApplication

A console application.

Webmozart\Console\ConsoleApplication implements Webmozart\Console\Api\Application\Application
Namespace: Webmozart\Console
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at ConsoleApplication.php
Methods summary
public
# __construct( Webmozart\Console\Api\Config\ApplicationConfig|callable $config )

Creates a new console application.

Creates a new console application.

Parameters

$config

The application configuration or a callable that creates the configuration.

public Webmozart\Console\Api\Config\ApplicationConfig
# getConfig( )

Returns the application configuration.

Returns the application configuration.

Returns

Webmozart\Console\Api\Config\ApplicationConfig
The application configuration.

Implementation of

Webmozart\Console\Api\Application\Application::getConfig()
public Webmozart\Console\Api\Args\Format\ArgsFormat
# getGlobalArgsFormat( )

Returns the global arguments format of the application.

Returns the global arguments format of the application.

Returns

Webmozart\Console\Api\Args\Format\ArgsFormat
The global arguments format.

Implementation of

Webmozart\Console\Api\Application\Application::getGlobalArgsFormat()
public Webmozart\Console\Api\Command\Command
# getCommand( string $name )

Returns the command for a given name.

Returns the command for a given name.

Parameters

$name
The name of the command.

Returns

Webmozart\Console\Api\Command\Command
The command.

Throws

NoSuchCommandException
If the command is not found.

Implementation of

Webmozart\Console\Api\Application\Application::getCommand()
public Webmozart\Console\Api\Command\CommandCollection
# getCommands( )

Returns all registered commands.

Returns all registered commands.

Returns

Webmozart\Console\Api\Command\CommandCollection
The commands.

Implementation of

Webmozart\Console\Api\Application\Application::getCommands()
public boolean
# hasCommand( string $name )

Returns whether the application has a command with a given name.

Returns whether the application has a command with a given name.

Parameters

$name
The name of the command.

Returns

boolean

Returns true if the command with the given name exists and false otherwise.

Implementation of

Webmozart\Console\Api\Application\Application::hasCommand()
public boolean
# hasCommands( )

Returns whether the application has any registered commands.

Returns whether the application has any registered commands.

Returns

boolean

Returns true if the application has any commands and false otherwise.

Implementation of

Webmozart\Console\Api\Application\Application::hasCommands()
public Webmozart\Console\Api\Command\CommandCollection
# getNamedCommands( )

Returns the commands that are not anonymous.

Returns the commands that are not anonymous.

Returns

Webmozart\Console\Api\Command\CommandCollection
The named commands.

Implementation of

Webmozart\Console\Api\Application\Application::getNamedCommands()
public boolean
# hasNamedCommands( )

Returns whether the application has any commands that are not anonymous.

Returns whether the application has any commands that are not anonymous.

Returns

boolean

Returns true if the application has named commands and false otherwise.

Implementation of

Webmozart\Console\Api\Application\Application::hasNamedCommands()
public Webmozart\Console\Api\Command\CommandCollection
# getDefaultCommands( )

Returns the commands that should be executed if no explicit command is passed.

Returns the commands that should be executed if no explicit command is passed.

Returns

Webmozart\Console\Api\Command\CommandCollection
The default commands.

Implementation of

Webmozart\Console\Api\Application\Application::getDefaultCommands()
public boolean
# hasDefaultCommands( )

Returns whether the application has any default commands.

Returns whether the application has any default commands.

Returns

boolean

Returns true if the application has default commands and false otherwise.

Implementation of

Webmozart\Console\Api\Application\Application::hasDefaultCommands()
public ResolvedCommand
# resolveCommand( Webmozart\Console\Api\Args\RawArgs $args )

Returns the command to execute for the given console arguments.

Returns the command to execute for the given console arguments.

Parameters

$args
The console arguments.

Returns

ResolvedCommand
The command to execute.

Throws

CannotResolveCommandException
If the command cannot be resolved.

Implementation of

Webmozart\Console\Api\Application\Application::resolveCommand()
public integer
# 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 )

Executes the command.

Executes the command.

Parameters

$args

The console arguments. If not given, the arguments passed to the PHP process are used.

$inputStream

The standard input. If not given, the application reads from the standard input of the PHP process.

$outputStream

The standard output. If not given, the application prints to the standard output of the PHP process.

$errorStream

The error output. If not given, the application prints to the error output of the PHP process.

Returns

integer
The exit status.

Implementation of

Webmozart\Console\Api\Application\Application::run()
Webmozart Console API API documentation generated by ApiGen