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

  • ApplicationConfig
  • CommandConfig
  • Config
  • OptionCommandConfig
  • SubCommandConfig
  • Overview
  • Namespace
  • Class

Class Config

Implements methods shared by all configurations.

Direct known subclasses

Webmozart\Console\Api\Config\ApplicationConfig, Webmozart\Console\Api\Config\CommandConfig

Indirect known subclasses

Webmozart\Console\Api\Config\OptionCommandConfig, Webmozart\Console\Api\Config\SubCommandConfig, Webmozart\Console\Config\DefaultApplicationConfig
Abstract
Namespace: Webmozart\Console\Api\Config
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Api/Config/Config.php
Methods summary
public
# __construct( )

Creates a new configuration.

Creates a new configuration.

public Webmozart\Console\Api\Args\Format\Argument[]
# getArguments( )

Returns the configured arguments.

Returns the configured arguments.

Read Webmozart\Console\Api\Args\Format\Argument for a more detailed description of arguments.

Returns

Webmozart\Console\Api\Args\Format\Argument[]
The configured arguments.

See

Webmozart\Console\Api\Config\Config::addArgument()
public Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
# addArgument( string $name, integer $flags = 0, string $description = null, mixed $default = null )

Adds an argument.

Adds an argument.

Read Webmozart\Console\Api\Args\Format\Argument for a more detailed description of console arguments.

Parameters

$name
The argument name.
$flags

A bitwise combination of the flag constants in the Webmozart\Console\Api\Args\Format\Argument class.

$description
A one-line description of the argument.
$default

The default value. Must be null if the flags contain Argument::REQUIRED.

Returns

Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
The current instance.

See

Webmozart\Console\Api\Config\Config::getArguments()
public Webmozart\Console\Api\Args\Format\Option[]
# getOptions( )

Returns the configured options.

Returns the configured options.

Read Webmozart\Console\Api\Args\Format\Option for a more detailed description of console options.

Returns

Webmozart\Console\Api\Args\Format\Option[]
The configured options.

See

Webmozart\Console\Api\Config\Config::addOption()
public Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
# addOption( string $longName, string $shortName = null, integer $flags = 0, string $description = null, mixed $default = null, string $valueName = '...' )

Adds an option.

Adds an option.

Read Webmozart\Console\Api\Args\Format\Option for a more detailed description of console options.

Parameters

$longName
The long option name.
$shortName
The short option name. Can be null.
$flags

A bitwise combination of the flag constants in the Webmozart\Console\Api\Args\Format\Option class.

$description
A one-line description of the option.
$default

The default value. Must be null if the flags contain Option::REQUIRED_VALUE.

$valueName

The name of the value to be used in usage examples of the option.

Returns

Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
The current instance.

See

Webmozart\Console\Api\Config\Config::getOptions()
public Symfony\Component\Console\Helper\HelperSet
# getHelperSet( )

Returns the configured helper set.

Returns the configured helper set.

Returns

Symfony\Component\Console\Helper\HelperSet
The helper set.

See

Webmozart\Console\Api\Config\Config::setHelperSet()
public Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
# setHelperSet( Symfony\Component\Console\Helper\HelperSet $helperSet )

Sets the used helper set.

Sets the used helper set.

Parameters

$helperSet
The helper set.

Returns

Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
The current instance.

See

Webmozart\Console\Api\Config\Config::getHelperSet()
public Webmozart\Console\Api\Args\ArgsParser
# getArgsParser( )

Returns the configured argument parser.

Returns the configured argument parser.

Returns

Webmozart\Console\Api\Args\ArgsParser
The argument parser.

See

Webmozart\Console\Api\Config\Config::setArgsParser()
public Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
# setArgsParser( Webmozart\Console\Api\Args\ArgsParser $argsParser )

Sets the used argument parser.

Sets the used argument parser.

Parameters

$argsParser
The argument parser.

Returns

Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
The current instance.

See

Webmozart\Console\Api\Config\Config::getArgsParser()
public boolean
# isLenientArgsParsingEnabled( )

Returns whether lenient argument parsing is enabled.

Returns whether lenient argument parsing is enabled.

When lenient argument parsing is enabled, the argument parser will not fail if the console arguments contain invalid or missing arguments.

Returns

boolean

Returns true if lenient parsing is enabled and false otherwise.

public Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
# enableLenientArgsParsing( )

Enables lenient argument parsing.

Enables lenient argument parsing.

When lenient argument parsing is enabled, the argument parser will not fail if the console arguments contain invalid or missing arguments.

Lenient argument parsing is disabled by default.

Returns

Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
The current instance.

See

Webmozart\Console\Api\Config\Config::disableLenientArgsParsing()
public Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
# disableLenientArgsParsing( )

Disables lenient argument parsing.

Disables lenient argument parsing.

When lenient argument parsing is enabled, the argument parser will not fail if the console arguments contain invalid or missing arguments.

Lenient argument parsing is disabled by default.

Returns

Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
The current instance.

See

Webmozart\Console\Api\Config\Config::enableLenientArgsParsing()
public object
# getHandler( )

Returns the command handler to execute when a command is run.

Returns the command handler to execute when a command is run.

Returns

object
The command handler.

See

Webmozart\Console\Api\Config\Config::setHandler()
public Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
# setHandler( object|callable $handler )

Sets the command handler to execute when a command is run.

Sets the command handler to execute when a command is run.

You can pass: * An object with handler methods. * A callable that receives a Command and returns an object with handler methods.

The name of the executed handler method can be configured with Webmozart\Console\Api\Config\Config::setHandlerMethod(). By default, the method handle() is executed.

Parameters

$handler

The command handler or the callable creating a new command handler on demand.

Returns

Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
The current instance.

See

Webmozart\Console\Api\Config\Config::getHandler()
public string
# getHandlerMethod( )

Returns the method of the command handler that should be executed when the configured command is run.

Returns the method of the command handler that should be executed when the configured command is run.

Returns

string
The method name.

See

Webmozart\Console\Api\Config\Config::setHandlerMethod()
public Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
# setHandlerMethod( string $handlerMethod )

Sets the method of the command handler that should be executed when the configured command is run.

Sets the method of the command handler that should be executed when the configured command is run.

The method receives three arguments: * Args $args: The console arguments. * IO $io: The I/O. * Command $command: The executed command.

Parameters

$handlerMethod
The method name.

Returns

Webmozart\Console\Api\Config\ApplicationConfig|Webmozart\Console\Api\Config\CommandConfig|Webmozart\Console\Api\Config\SubCommandConfig|Webmozart\Console\Api\Config\OptionCommandConfig
The current instance.

See

Webmozart\Console\Api\Config\Config::getHandlerMethod()
protected Symfony\Component\Console\Helper\HelperSet
# getDefaultHelperSet( )

Returns the helper set to use if none is set.

Returns the helper set to use if none is set.

Returns

Symfony\Component\Console\Helper\HelperSet
The default helper set.
protected object
# getDefaultHandler( )

Returns the command handler to use if none is set.

Returns the command handler to use if none is set.

Returns

object
The default command handler.
protected string
# getDefaultHandlerMethod( )

Returns the handler method to use if none is set.

Returns the handler method to use if none is set.

Returns

string
The default handler method.
protected Webmozart\Console\Api\Args\ArgsParser
# getDefaultArgsParser( )

Returns the arguments parser to use if none is set.

Returns the arguments parser to use if none is set.

Returns

Webmozart\Console\Api\Args\ArgsParser
The default args parser.
protected boolean
# getDefaultLenientArgsParsing( )

Returns whether the arguments parsing handles errors gracefully.

Returns whether the arguments parsing handles errors gracefully.

Returns

boolean
The default value for lenient args parsing.
protected
# configure( )

Adds the default configuration.

Adds the default configuration.

Override this method in your own subclasses.

Webmozart Console API API documentation generated by ApiGen