Methods summary
public static
static
|
#
create( string $name = null, string $version = null )
Creates a new console application.
Creates a new console application.
Parameters
- $name
- The name of the application.
- $version
- The application version.
Returns
static The created instance.
|
public
|
#
__construct( string $name = null, string $version = null )
Creates a new console application.
Creates a new console application.
Parameters
- $name
- The name of the application.
- $version
- The application version.
Overrides
|
public
string
|
#
getName( )
Returns the name of the application.
Returns the name of the application.
Returns
string The application name.
See
|
public
static
|
#
setName( string $name )
Sets the name of the application.
Sets the name of the application.
Parameters
- $name
- The application name.
Returns
static The current instance.
See
|
public
string
|
#
getDisplayName( )
Returns the application name as it is displayed in the help.
|
public
static
|
#
setDisplayName( string $displayName )
Sets the application name as it is displayed in the help.
Sets the application name as it is displayed in the help.
Parameters
- $displayName
- The display name.
Returns
static The current instance.
See
|
public
string
|
#
getVersion( )
Returns the version of the application.
Returns the version of the application.
Returns
string The application version.
|
public
static
|
#
setVersion( string $version )
Sets the version of the application.
Sets the version of the application.
Parameters
- $version
- The application version.
Returns
static The current instance.
|
public
string
|
#
getHelp( )
Returns the help text of the application.
Returns the help text of the application.
Returns
string The help text.
|
public
static
|
#
setHelp( string $help )
Sets the help text of the application.
Sets the help text of the application.
Parameters
Returns
static The current instance.
|
public
Symfony\Component\EventDispatcher\EventDispatcherInterface
|
#
getEventDispatcher( )
Returns the event dispatcher used to dispatch the console events.
Returns the event dispatcher used to dispatch the console events.
Returns
Symfony\Component\EventDispatcher\EventDispatcherInterface The event dispatcher.
|
public
static
|
#
setEventDispatcher( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null )
Sets the event dispatcher for dispatching the console events.
Sets the event dispatcher for dispatching the console events.
Parameters
- $dispatcher
- The event dispatcher.
Returns
static The current instance.
|
public
static
|
#
addEventListener( string $eventName, callable $listener, integer $priority = 0 )
Adds a listener for the given event name.
Adds a listener for the given event name.
See ConsoleEvents for the supported event names.
Parameters
- $eventName
- The event to listen to.
- $listener
The callback to execute when the event is
dispatched.
- $priority
- The event priority.
Returns
static The current instance.
See
EventDispatcherInterface::addListener()
|
public
static
|
#
addEventSubscriber( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber )
Adds an event subscriber to the dispatcher.
Adds an event subscriber to the dispatcher.
Parameters
- $subscriber
- The subscriber to add.
Returns
static The current instance.
See
EventDispatcherInterface::addSubscriber()
|
public
static
|
#
removeEventListener( string $eventName, callable $listener )
Removes an event listener for the given event name.
Removes an event listener for the given event name.
Parameters
- $eventName
- The event name.
- $listener
- The callback to remove.
Returns
static The current instance.
See
EventDispatcherInterface::removeListener()
|
public
static
|
#
removeEventSubscriber( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber )
Removes an event subscriber from the dispatcher.
Removes an event subscriber from the dispatcher.
Parameters
- $subscriber
- The subscriber to remove.
Returns
static The current instance.
See
EventDispatcherInterface::removeSubscriber()
|
public
boolean
|
#
isExceptionCaught( )
Returns whether the application catches and displays exceptions thrown
while running a command.
Returns whether the application catches and displays exceptions thrown
while running a command.
Returns
boolean Returns true if exceptions are caught and false
otherwise.
See
|
public
static
|
#
setCatchExceptions( boolean $catch )
Sets whether the application catches and displays exceptions thrown
while running a command.
Sets whether the application catches and displays exceptions thrown
while running a command.
Parameters
- $catch
Whether to catch and display exceptions thrown
while running a command.
Returns
static The current instance.
See
|
public
boolean
|
#
isTerminatedAfterRun( )
Returns whether the PHP process is terminated after running a command.
Returns whether the PHP process is terminated after running a command.
Returns
boolean Returns true if the PHP process is terminated after
run() and false otherwise.
See
|
public
static
|
#
setTerminateAfterRun( boolean $terminate )
Sets whether to terminate the PHP process after running a command.
Sets whether to terminate the PHP process after running a command.
Parameters
- $terminate
Whether to terminate the PHP process after
running a command.
Returns
static The current instance.
See
|
public
Webmozart\Console\Api\Resolver\CommandResolver
|
#
getCommandResolver( )
Returns the used command resolver.
Returns the used command resolver.
Returns
See
|
public
static
|
|
public
callable
|
#
getIOFactory( )
Returns the callable used to create IO instances.
Returns the callable used to create IO instances.
Returns
callable The callable or null if none was set.
See
|
public
static
|
#
setIOFactory( callable $ioFactory )
Sets the callable used to create IO instances.
Sets the callable used to create IO instances.
The callable receives four arguments:
* RawArgs: The raw console arguments. * Input: The input. * Output: The output. * Output: The error output.
The input and output instances may be null if none were passed to
Application::run().
Parameters
- $ioFactory
- The IO factory callable.
Returns
static The current instance.
|
public
boolean
|
#
isDebug( )
Returns whether the application is in debug mode.
Returns whether the application is in debug mode.
In debug mode, the verbosity is always IO::DEBUG.
Returns
boolean Returns true if the application is in debug mode.
See
|
public
static
|
#
setDebug( boolean $debug )
Sets whether the application is in debug mode.
Sets whether the application is in debug mode.
In debug mode, the verbosity is always IO::DEBUG.
Parameters
- $debug
- Set to
true to activate the debug mode.
Returns
static The current instance.
See
|
public
Webmozart\Console\Api\Formatter\StyleSet
|
#
getStyleSet( )
Returns the configured style set.
Returns the configured style set.
Returns
See
|
public
static
|
|
public
static
|
|
public
static
|
#
addStyles( array $styles )
Adds multiple styles to the style set.
Adds multiple styles to the style set.
Parameters
- $styles
- The styles to add.
Returns
static The current instance.
See
StyleSet::merge()
|
public
static
|
#
removeStyle( string $tag )
Removes a style from the style set.
Removes a style from the style set.
Parameters
- $tag
- The tag of the style to remove.
Returns
static The current instance.
See
StyleSet::remove()
|
public
Webmozart\Console\Api\Config\CommandConfig
|
#
beginCommand( string $name )
Starts a configuration block for a command.
Starts a configuration block for a command.
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 CommandConfig::end():
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()
}
Parameters
- $name
- The name of the command.
Returns
See
|
public
Webmozart\Console\Api\Config\CommandConfig
|
|
public
static
|
|
public
static
|
#
addCommandConfigs( array $configs )
Adds command configurations to the application.
Adds command configurations to the application.
Parameters
- $configs
- The command configurations.
Returns
static The current instance.
See
|
public
static
|
#
setCommandConfigs( array $configs )
Sets the command configurations of the application.
Sets the command configurations of the application.
Parameters
- $configs
- The command configurations.
Returns
static The current instance.
See
|
public
Webmozart\Console\Api\Config\CommandConfig
|
#
getCommandConfig( string $name )
Returns the command configuration for a given name.
Returns the command configuration for a given name.
Parameters
- $name
- The name of the command.
Returns
Throws
See
|
public
Webmozart\Console\Api\Config\CommandConfig[]
|
#
getCommandConfigs( )
Returns all registered command configurations.
Returns all registered command configurations.
Returns
See
|
public
boolean
|
#
hasCommandConfig( 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 configuration with the given
name exists and false otherwise.
See
|
public
boolean
|
#
hasCommandConfigs( )
Returns whether the application has any registered command configurations.
Returns whether the application has any registered command configurations.
Returns
boolean Returns true if command configurations were added to the
application and false otherwise.
See
|
protected
string
|
#
getDefaultDisplayName( )
Returns the default display name used if no display name is set.
Returns the default display name used if no display name is set.
Returns
string The default display name.
|