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

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

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

Метод Описание
__construct ( string $name = null, string $version = null ) Creates a new console application.
addCommandConfig ( CommandConfig $config ) : static Adds a command configuration to the application.
addCommandConfigs ( array $configs ) : static Adds command configurations to the application.
addEventListener ( string $eventName, callable $listener, integer $priority ) : static Adds a listener for the given event name.
addEventSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber ) : static Adds an event subscriber to the dispatcher.
addStyle ( Style $style ) : static Adds a style to the style set.
addStyles ( array $styles ) : static Adds multiple styles to the style set.
beginCommand ( string $name ) : CommandConfig Starts a configuration block for a command.
create ( string $name = null, string $version = null ) : static Creates a new console application.
editCommand ( string $name ) : CommandConfig Alias for {@link getCommandConfig()}.
getCommandConfig ( string $name ) : CommandConfig Returns the command configuration for a given name.
getCommandConfigs ( ) : CommandConfig[] Returns all registered command configurations.
getCommandResolver ( ) : Webmozart\Console\Api\Resolver\CommandResolver Returns the used command resolver.
getDisplayName ( ) : string Returns the application name as it is displayed in the help.
getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface Returns the event dispatcher used to dispatch the console events.
getHelp ( ) : string Returns the help text of the application.
getIOFactory ( ) : callable Returns the callable used to create {@link IO} instances.
getName ( ) : string Returns the name of the application.
getStyleSet ( ) : StyleSet Returns the configured style set.
getVersion ( ) : string Returns the version of the application.
hasCommandConfig ( string $name ) : boolean Returns whether the application has a command with a given name.
hasCommandConfigs ( ) : boolean Returns whether the application has any registered command configurations.
isDebug ( ) : boolean Returns whether the application is in debug mode.
isExceptionCaught ( ) : boolean Returns whether the application catches and displays exceptions thrown while running a command.
isTerminatedAfterRun ( ) : boolean Returns whether the PHP process is terminated after running a command.
removeEventListener ( string $eventName, callable $listener ) : static Removes an event listener for the given event name.
removeEventSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber ) : static Removes an event subscriber from the dispatcher.
removeStyle ( string $tag ) : static Removes a style from the style set.
setCatchExceptions ( boolean $catch ) : static Sets whether the application catches and displays exceptions thrown while running a command.
setCommandConfigs ( array $configs ) : static Sets the command configurations of the application.
setCommandResolver ( Webmozart\Console\Api\Resolver\CommandResolver $commandResolver ) : static Sets the used command resolver.
setDebug ( boolean $debug ) : static Sets whether the application is in debug mode.
setDisplayName ( string $displayName ) : static Sets the application name as it is displayed in the help.
setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null ) : static Sets the event dispatcher for dispatching the console events.
setHelp ( string $help ) : static Sets the help text of the application.
setIOFactory ( callable $ioFactory ) : static Sets the callable used to create {@link IO} instances.
setName ( string $name ) : static Sets the name of the application.
setStyleSet ( StyleSet $styleSet ) : static Sets the used style set.
setTerminateAfterRun ( boolean $terminate ) : static Sets whether to terminate the PHP process after running a command.
setVersion ( string $version ) : static Sets the version of the application.

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

Метод Описание
getDefaultDisplayName ( ) : string Returns the default display name used if no display name is set.

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

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

Creates a new console application.
public __construct ( string $name = null, string $version = null )
$name string The name of the application.
$version string The application version.

addCommandConfig() публичный метод

Adds a command configuration to the application.
См. также: beginCommand()
public addCommandConfig ( CommandConfig $config ) : static
$config CommandConfig The command configuration.
Результат static The current instance.

addCommandConfigs() публичный метод

Adds command configurations to the application.
См. также: beginCommand()
public addCommandConfigs ( array $configs ) : static
$configs array The command configurations.
Результат static The current instance.

addEventListener() публичный метод

See {@link ConsoleEvents} for the supported event names.
См. также: EventDispatcherInterface::addListener()
public addEventListener ( string $eventName, callable $listener, integer $priority ) : static
$eventName string The event to listen to.
$listener callable The callback to execute when the event is dispatched.
$priority integer The event priority.
Результат static The current instance.

addEventSubscriber() публичный метод

Adds an event subscriber to the dispatcher.
См. также: EventDispatcherInterface::addSubscriber()
public addEventSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber ) : static
$subscriber Symfony\Component\EventDispatcher\EventSubscriberInterface The subscriber to add.
Результат static The current instance.

addStyle() публичный метод

Adds a style to the style set.
См. также: StyleSet::add()
public addStyle ( Style $style ) : static
$style Webmozart\Console\Api\Formatter\Style The style to add.
Результат static The current instance.

addStyles() публичный метод

Adds multiple styles to the style set.
См. также: StyleSet::merge()
public addStyles ( array $styles ) : static
$styles array The styles to add.
Результат static The current instance.

beginCommand() публичный метод

The configuration of the command is returned by this method. You can use the fluent interface to configure the sub-command before jumping back to this configuration with {@link CommandConfig::end()}: php protected function configure() { $this ->setName('server') ->setDescription('List and manage servers') ->beginCommand('add') ->setDescription('Add a server') ->addArgument('host', Argument::REQUIRED) ->addOption('port', 'p', Option::VALUE_OPTIONAL, null, 80) ->end() ... ; }
См. также: editCommand()
public beginCommand ( string $name ) : CommandConfig
$name string The name of the command.
Результат CommandConfig The command configuration.

create() публичный статический метод

Creates a new console application.
public static create ( string $name = null, string $version = null ) : static
$name string The name of the application.
$version string The application version.
Результат static The created instance.

editCommand() публичный метод

This method can be used to nicely edit a command inherited from a parent configuration using the fluent API: php protected function configure() { parent::configure(); $this ->editCommand('add') ... ->end() ... ; }
См. также: beginCommand()
public editCommand ( string $name ) : CommandConfig
$name string The name of the command to edit.
Результат CommandConfig The command configuration.

getCommandConfig() публичный метод

Returns the command configuration for a given name.
См. также: beginCommand()
public getCommandConfig ( string $name ) : CommandConfig
$name string The name of the command.
Результат CommandConfig The command configuration.

getCommandConfigs() публичный метод

Returns all registered command configurations.
См. также: beginCommand()
public getCommandConfigs ( ) : CommandConfig[]
Результат CommandConfig[] The command configurations.

getCommandResolver() публичный метод

Returns the used command resolver.
См. также: setCommandResolver()
public getCommandResolver ( ) : Webmozart\Console\Api\Resolver\CommandResolver
Результат Webmozart\Console\Api\Resolver\CommandResolver The command resolver.

getDefaultDisplayName() защищенный метод

Returns the default display name used if no display name is set.
protected getDefaultDisplayName ( ) : string
Результат string The default display name.

getDisplayName() публичный метод

If no display name is set with {@link setDisplayName()}, the humanized application name is returned.
См. также: setDisplayName()
public getDisplayName ( ) : string
Результат string The display name.

getEventDispatcher() публичный метод

Returns the event dispatcher used to dispatch the console events.
public getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
Результат Symfony\Component\EventDispatcher\EventDispatcherInterface The event dispatcher.

getHelp() публичный метод

Returns the help text of the application.
public getHelp ( ) : string
Результат string The help text.

getIOFactory() публичный метод

Returns the callable used to create {@link IO} instances.
См. также: setIOFactory()
public getIOFactory ( ) : callable
Результат callable The callable or `null` if none was set.

getName() публичный метод

Returns the name of the application.
См. также: setName()
public getName ( ) : string
Результат string The application name.

getStyleSet() публичный метод

Returns the configured style set.
См. также: setStyleSet()
public getStyleSet ( ) : StyleSet
Результат Webmozart\Console\Api\Formatter\StyleSet The style set.

getVersion() публичный метод

Returns the version of the application.
public getVersion ( ) : string
Результат string The application version.

hasCommandConfig() публичный метод

Returns whether the application has a command with a given name.
См. также: beginCommand()
public hasCommandConfig ( string $name ) : boolean
$name string The name of the command.
Результат boolean Returns `true` if the command configuration with the given name exists and `false` otherwise.

hasCommandConfigs() публичный метод

Returns whether the application has any registered command configurations.
См. также: beginCommand()
public hasCommandConfigs ( ) : boolean
Результат boolean Returns `true` if command configurations were added to the application and `false` otherwise.

isDebug() публичный метод

In debug mode, the verbosity is always {@link IO::DEBUG}.
См. также: setDebug()
public isDebug ( ) : boolean
Результат boolean Returns `true` if the application is in debug mode.

isExceptionCaught() публичный метод

Returns whether the application catches and displays exceptions thrown while running a command.
См. также: setCatchExceptions()
public isExceptionCaught ( ) : boolean
Результат boolean Returns `true` if exceptions are caught and `false` otherwise.

isTerminatedAfterRun() публичный метод

Returns whether the PHP process is terminated after running a command.
См. также: setTerminateAfterRun()
public isTerminatedAfterRun ( ) : boolean
Результат boolean Returns `true` if the PHP process is terminated after {@link run()} and `false` otherwise.

removeEventListener() публичный метод

Removes an event listener for the given event name.
См. также: EventDispatcherInterface::removeListener()
public removeEventListener ( string $eventName, callable $listener ) : static
$eventName string The event name.
$listener callable The callback to remove.
Результат static The current instance.

removeEventSubscriber() публичный метод

Removes an event subscriber from the dispatcher.
См. также: EventDispatcherInterface::removeSubscriber()
public removeEventSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber ) : static
$subscriber Symfony\Component\EventDispatcher\EventSubscriberInterface The subscriber to remove.
Результат static The current instance.

removeStyle() публичный метод

Removes a style from the style set.
См. также: StyleSet::remove()
public removeStyle ( string $tag ) : static
$tag string The tag of the style to remove.
Результат static The current instance.

setCatchExceptions() публичный метод

Sets whether the application catches and displays exceptions thrown while running a command.
См. также: isExceptionCaught()
public setCatchExceptions ( boolean $catch ) : static
$catch boolean Whether to catch and display exceptions thrown while running a command.
Результат static The current instance.

setCommandConfigs() публичный метод

Sets the command configurations of the application.
См. также: beginCommand()
public setCommandConfigs ( array $configs ) : static
$configs array The command configurations.
Результат static The current instance.

setCommandResolver() публичный метод

Sets the used command resolver.
См. также: getCommandResolver()
public setCommandResolver ( Webmozart\Console\Api\Resolver\CommandResolver $commandResolver ) : static
$commandResolver Webmozart\Console\Api\Resolver\CommandResolver The command resolver.
Результат static The current instance.

setDebug() публичный метод

In debug mode, the verbosity is always {@link IO::DEBUG}.
См. также: isDebug()
public setDebug ( boolean $debug ) : static
$debug boolean Set to `true` to activate the debug mode.
Результат static The current instance.

setDisplayName() публичный метод

Sets the application name as it is displayed in the help.
См. также: getDisplayName()
public setDisplayName ( string $displayName ) : static
$displayName string The display name.
Результат static The current instance.

setEventDispatcher() публичный метод

Sets the event dispatcher for dispatching the console events.
public setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null ) : static
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface The event dispatcher.
Результат static The current instance.

setHelp() публичный метод

Sets the help text of the application.
public setHelp ( string $help ) : static
$help string The help text.
Результат static The current instance.

setIOFactory() публичный метод

The callable receives four arguments: * {@link RawArgs}: The raw console arguments. * {@link Input}: The input. * {@link Output}: The output. * {@link Output}: The error output. The input and output instances may be null if none were passed to {@link Application::run()}.
public setIOFactory ( callable $ioFactory ) : static
$ioFactory callable The {@link IO} factory callable.
Результат static The current instance.

setName() публичный метод

Sets the name of the application.
См. также: getName()
public setName ( string $name ) : static
$name string The application name.
Результат static The current instance.

setStyleSet() публичный метод

Sets the used style set.
См. также: getStyleSet()
public setStyleSet ( StyleSet $styleSet ) : static
$styleSet Webmozart\Console\Api\Formatter\StyleSet The style set to use.
Результат static The current instance.

setTerminateAfterRun() публичный метод

Sets whether to terminate the PHP process after running a command.
См. также: isTerminatedAfterRun()
public setTerminateAfterRun ( boolean $terminate ) : static
$terminate boolean Whether to terminate the PHP process after running a command.
Результат static The current instance.

setVersion() публичный метод

Sets the version of the application.
public setVersion ( string $version ) : static
$version string The application version.
Результат static The current instance.