Methods summary
public
|
#
__construct( string|null $name = null )
Constructor.
Parameters
- $name
- The name of the command; passing null means it must be set in configure()
Throws
|
public
|
#
ignoreValidationErrors( )
Ignores validation errors.
Ignores validation errors.
This is mainly useful for the help command.
|
public
|
|
public
|
|
public
Symfony\Component\Console\Helper\HelperSet
|
|
public
Symfony\Component\Console\Application
|
#
getApplication( )
Gets the application instance for this command.
Gets the application instance for this command.
Returns
|
public
boolean
|
#
isEnabled( )
Checks whether the command is enabled or not in the current environment.
Checks whether the command is enabled or not in the current environment.
Override this to check for x or y and return false if the command can not
run properly under the current conditions.
Returns
boolean
|
protected
|
#
configure( )
Configures the current command.
Configures the current command.
|
protected
null|integer
|
#
execute( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
Executes the current command.
Executes the current command.
This method is not abstract because you can use this class
as a concrete class. In this case, instead of defining the
execute() method, you set the code to execute by passing
a Closure to the setCode() method.
Parameters
- $input
- An InputInterface instance
- $output
- An OutputInterface instance
Returns
null|integer null or 0 if everything went fine, or an error code
Throws
See
|
protected
|
|
protected
|
|
public
integer
|
|
public
Symfony\Component\Console\Command\Command
|
#
setCode( callable $code )
Sets the code to execute when running this command.
Sets the code to execute when running this command.
If this method is used, it overrides the code defined
in the execute() method.
Parameters
- $code
- A callable(InputInterface $input, OutputInterface $output)
Returns
Throws
See
|
public
|
#
mergeApplicationDefinition( boolean $mergeArgs = true )
Merges the application definition with the command definition.
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
Parameters
- $mergeArgs
- Whether to merge or not the Application definition arguments to Command definition arguments
|
public
Symfony\Component\Console\Command\Command
|
|
public
Symfony\Component\Console\Input\InputDefinition
|
#
getDefinition( )
Gets the InputDefinition attached to this Command.
Gets the InputDefinition attached to this Command.
Returns
|
public
Symfony\Component\Console\Input\InputDefinition
|
#
getNativeDefinition( )
Gets the InputDefinition to be used to create XML and Text representations of this Command.
Gets the InputDefinition to be used to create XML and Text representations of this Command.
Can be overridden to provide the original command representation when it would otherwise
be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
Returns
|
public
Symfony\Component\Console\Command\Command
|
#
addArgument( string $name, integer $mode = null, string $description = '', mixed $default = null )
Adds an argument.
Parameters
- $name
- The argument name
- $mode
- The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
- $description
- A description text
- $default
- The default value (for InputArgument::OPTIONAL mode only)
Returns
|
public
Symfony\Component\Console\Command\Command
|
#
addOption( string $name, string $shortcut = null, integer $mode = null, string $description = '', mixed $default = null )
Adds an option.
Parameters
- $name
- The option name
- $shortcut
- The shortcut (can be null)
- $mode
- The option mode: One of the InputOption::VALUE_* constants
- $description
- A description text
- $default
- The default value (must be null for InputOption::VALUE_NONE)
Returns
|
public
Symfony\Component\Console\Command\Command
|
#
setName( string $name )
Sets the name of the command.
Sets the name of the command.
This method can set both the namespace and the name if
you separate them by a colon (:)
$command->setName('foo:bar');
Parameters
Returns
Throws
|
public
Symfony\Component\Console\Command\Command
|
#
setProcessTitle( string $title )
Sets the process title of the command.
Sets the process title of the command.
This feature should be used only when creating a long process command,
like a daemon.
PHP 5.5+ or the proctitle PECL library is required
Parameters
Returns
|
public
string
|
#
getName( )
Returns the command name.
Returns the command name.
Returns
string The command name
|
public
Symfony\Component\Console\Command\Command
|
#
setDescription( string $description )
Sets the description for the command.
Sets the description for the command.
Parameters
- $description
- The description for the command
Returns
|
public
string
|
#
getDescription( )
Returns the description for the command.
Returns the description for the command.
Returns
string The description for the command
|
public
Symfony\Component\Console\Command\Command
|
#
setHelp( string $help )
Sets the help for the command.
Sets the help for the command.
Parameters
- $help
- The help for the command
Returns
|
public
string
|
#
getHelp( )
Returns the help for the command.
Returns the help for the command.
Returns
string The help for the command
|
public
string
|
#
getProcessedHelp( )
Returns the processed help for the command replacing the %command.name% and
%command.full_name% patterns with the real values dynamically.
Returns the processed help for the command replacing the %command.name% and
%command.full_name% patterns with the real values dynamically.
Returns
string The processed help for the command
|
public
Symfony\Component\Console\Command\Command
|
#
setAliases( string[] $aliases )
Sets the aliases for the command.
Sets the aliases for the command.
Parameters
- $aliases
- An array of aliases for the command
Returns
Throws
|
public
array
|
#
getAliases( )
Returns the aliases for the command.
Returns the aliases for the command.
Returns
array An array of aliases for the command
|
public
string
|
#
getSynopsis( boolean $short = false )
Returns the synopsis for the command.
Returns the synopsis for the command.
Parameters
- $short
- Whether to show the short version of the synopsis (with options folded) or not
Returns
string The synopsis
|
public
Symfony\Component\Console\Command\Command
|
#
addUsage( string $usage )
Add a command usage example.
Add a command usage example.
Parameters
- $usage
- The usage, it'll be prefixed with the command name
Returns
|
public
array
|
#
getUsages( )
Returns alternative usages of the command.
Returns alternative usages of the command.
Returns
array
|
public
mixed
|
#
getHelper( string $name )
Gets a helper instance by name.
Gets a helper instance by name.
Parameters
Returns
mixed The helper value
Throws
|
public
string
|
#
asText( )
Returns a text representation of the command.
Returns a text representation of the command.
Deprecated
since version 2.3, to be removed in 3.0.
Returns
string A string representing the command
|
public
string|DOMDocument
|
#
asXml( boolean $asDom = false )
Returns an XML representation of the command.
Returns an XML representation of the command.
Deprecated
since version 2.3, to be removed in 3.0.
Parameters
- $asDom
- Whether to return a DOM or an XML string
Returns
string|DOMDocument An XML string representing the command
|