PHP Класс Webmozart\Console\Api\Config\Config

С версии: 1.0
Автор: Bernhard Schussek ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( ) Creates a new configuration.
addArgument ( string $name, integer $flags, string $description = null, mixed $default = null ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig Adds an argument.
addOption ( string $longName, string $shortName = null, integer $flags, string $description = null, mixed $default = null, string $valueName = '...' ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig Adds an option.
disableLenientArgsParsing ( ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig Disables lenient argument parsing.
enableLenientArgsParsing ( ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig Enables lenient argument parsing.
getArgsParser ( ) : Webmozart\Console\Api\Args\ArgsParser Returns the configured argument parser.
getArguments ( ) : Argument[] Returns the configured arguments.
getHandler ( ) : object Returns the command handler to execute when a command is run.
getHandlerMethod ( ) : string Returns the method of the command handler that should be executed when the configured command is run.
getHelperSet ( ) : Symfony\Component\Console\Helper\HelperSet Returns the configured helper set.
getOptions ( ) : Option[] Returns the configured options.
isLenientArgsParsingEnabled ( ) : boolean Returns whether lenient argument parsing is enabled.
setArgsParser ( Webmozart\Console\Api\Args\ArgsParser $argsParser ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig Sets the used argument parser.
setHandler ( object | callback $handler ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig Sets the command handler to execute when a command is run.
setHandlerMethod ( string $handlerMethod ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig Sets the method of the command handler that should be executed when the configured command is run.
setHelperSet ( Symfony\Component\Console\Helper\HelperSet $helperSet ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig Sets the used helper set.

Защищенные методы

Метод Описание
configure ( ) Adds the default configuration.
getDefaultArgsParser ( ) : Webmozart\Console\Api\Args\ArgsParser Returns the arguments parser to use if none is set.
getDefaultHandler ( ) : object Returns the command handler to use if none is set.
getDefaultHandlerMethod ( ) : string Returns the handler method to use if none is set.
getDefaultHelperSet ( ) : Symfony\Component\Console\Helper\HelperSet Returns the helper set to use if none is set.
getDefaultLenientArgsParsing ( ) : boolean Returns whether the arguments parsing handles errors gracefully.

Описание методов

__construct() публичный Метод

Creates a new configuration.
public __construct ( )

addArgument() публичный Метод

Read {@link Argument} for a more detailed description of console arguments.
См. также: getArguments()
public addArgument ( string $name, integer $flags, string $description = null, mixed $default = null ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
$name string The argument name.
$flags integer A bitwise combination of the flag constants in the {@link Argument} class.
$description string A one-line description of the argument.
$default mixed The default value. Must be `null` if the flags contain {@link Argument::REQUIRED}.
Результат ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.

addOption() публичный Метод

Read {@link Option} for a more detailed description of console options.
См. также: getOptions()
public addOption ( string $longName, string $shortName = null, integer $flags, string $description = null, mixed $default = null, string $valueName = '...' ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
$longName string The long option name.
$shortName string The short option name. Can be `null`.
$flags integer A bitwise combination of the flag constants in the {@link Option} class.
$description string A one-line description of the option.
$default mixed The default value. Must be `null` if the flags contain {@link Option::REQUIRED_VALUE}.
$valueName string The name of the value to be used in usage examples of the option.
Результат ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.

configure() защищенный Метод

Override this method in your own subclasses.
protected configure ( )

disableLenientArgsParsing() публичный Метод

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.
См. также: enableLenientArgsParsing()
public disableLenientArgsParsing ( ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
Результат ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.

enableLenientArgsParsing() публичный Метод

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.
См. также: disableLenientArgsParsing()
public enableLenientArgsParsing ( ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
Результат ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.

getArgsParser() публичный Метод

Returns the configured argument parser.
См. также: setArgsParser()
public getArgsParser ( ) : Webmozart\Console\Api\Args\ArgsParser
Результат Webmozart\Console\Api\Args\ArgsParser The argument parser.

getArguments() публичный Метод

Read {@link Argument} for a more detailed description of arguments.
См. также: addArgument()
public getArguments ( ) : Argument[]
Результат Webmozart\Console\Api\Args\Format\Argument[] The configured arguments.

getDefaultArgsParser() защищенный Метод

Returns the arguments parser to use if none is set.
protected getDefaultArgsParser ( ) : Webmozart\Console\Api\Args\ArgsParser
Результат Webmozart\Console\Api\Args\ArgsParser The default args parser.

getDefaultHandler() защищенный Метод

Returns the command handler to use if none is set.
protected getDefaultHandler ( ) : object
Результат object The default command handler.

getDefaultHandlerMethod() защищенный Метод

Returns the handler method to use if none is set.
protected getDefaultHandlerMethod ( ) : string
Результат string The default handler method.

getDefaultHelperSet() защищенный Метод

Returns the helper set to use if none is set.
protected getDefaultHelperSet ( ) : Symfony\Component\Console\Helper\HelperSet
Результат Symfony\Component\Console\Helper\HelperSet The default helper set.

getDefaultLenientArgsParsing() защищенный Метод

Returns whether the arguments parsing handles errors gracefully.
protected getDefaultLenientArgsParsing ( ) : boolean
Результат boolean The default value for lenient args parsing.

getHandler() публичный Метод

Returns the command handler to execute when a command is run.
См. также: setHandler()
public getHandler ( ) : object
Результат object The command handler.

getHandlerMethod() публичный Метод

Returns the method of the command handler that should be executed when the configured command is run.
См. также: setHandlerMethod()
public getHandlerMethod ( ) : string
Результат string The method name.

getHelperSet() публичный Метод

Returns the configured helper set.
См. также: setHelperSet()
public getHelperSet ( ) : Symfony\Component\Console\Helper\HelperSet
Результат Symfony\Component\Console\Helper\HelperSet The helper set.

getOptions() публичный Метод

Read {@link Option} for a more detailed description of console options.
См. также: addOption()
public getOptions ( ) : Option[]
Результат Webmozart\Console\Api\Args\Format\Option[] The configured options.

isLenientArgsParsingEnabled() публичный Метод

When lenient argument parsing is enabled, the argument parser will not fail if the console arguments contain invalid or missing arguments.
public isLenientArgsParsingEnabled ( ) : boolean
Результат boolean Returns `true` if lenient parsing is enabled and `false` otherwise.

setArgsParser() публичный Метод

Sets the used argument parser.
См. также: getArgsParser()
public setArgsParser ( Webmozart\Console\Api\Args\ArgsParser $argsParser ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
$argsParser Webmozart\Console\Api\Args\ArgsParser The argument parser.
Результат ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.

setHandler() публичный Метод

You can pass: * An object with handler methods. * A callable that receives a {@link Command} and returns an object with handler methods. The name of the executed handler method can be configured with {@link setHandlerMethod()}. By default, the method handle() is executed.
См. также: getHandler()
public setHandler ( object | callback $handler ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
$handler object | callback The command handler or the callable creating a new command handler on demand.
Результат ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.

setHandlerMethod() публичный Метод

The method receives three arguments: * {@link Args} $args: The console arguments. * {@link IO} $io: The I/O. * {@link Command} $command: The executed command.
См. также: getHandlerMethod()
public setHandlerMethod ( string $handlerMethod ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
$handlerMethod string The method name.
Результат ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.

setHelperSet() публичный Метод

Sets the used helper set.
См. также: getHelperSet()
public setHelperSet ( Symfony\Component\Console\Helper\HelperSet $helperSet ) : ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig
$helperSet Symfony\Component\Console\Helper\HelperSet The helper set.
Результат ApplicationConfig | CommandConfig | SubCommandConfig | OptionCommandConfig The current instance.