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

Interfaces

  • Application
  • Overview
  • Namespace
  • Class

Interface Application

A console application.

Direct known implementers

Webmozart\Console\ConsoleApplication
Namespace: Webmozart\Console\Api\Application
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Api/Application/Application.php
Methods summary
public Webmozart\Console\Api\Config\ApplicationConfig
# getConfig( )

Returns the application configuration.

Returns the application configuration.

Returns

Webmozart\Console\Api\Config\ApplicationConfig
The application configuration.
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.
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

Webmozart\Console\Api\Command\NoSuchCommandException
If the command is not found.

See

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

Returns all registered commands.

Returns all registered commands.

Returns

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

See

addCommand(), Webmozart\Console\Api\Application\Application::getCommand()
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.

See

Webmozart\Console\Api\Application\Application::hasCommands(), Webmozart\Console\Api\Application\Application::getCommand()
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.

See

Webmozart\Console\Api\Application\Application::hasCommand(), Webmozart\Console\Api\Application\Application::getCommands()
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.
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.

See

Webmozart\Console\Api\Application\Application::getNamedCommands()
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.
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.

See

Webmozart\Console\Api\Application\Application::getDefaultCommands()
public Webmozart\Console\Api\Resolver\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

Webmozart\Console\Api\Resolver\ResolvedCommand
The command to execute.

Throws

Webmozart\Console\Api\Resolver\CannotResolveCommandException
If the command cannot be resolved.
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.
Webmozart Console API API documentation generated by ApiGen