class TranslationUpdateCommand extends ContainerAwareCommand

A command that parses templates to extract translation messages and adds them into the translation files.

Methods

__construct(string|null $name = null)

No description

from Command
ignoreValidationErrors()

Ignores validation errors.

from Command
setApplication(Application $application = null)

No description

from Command
setHelperSet(HelperSet $helperSet)

No description

from Command
getHelperSet()

Gets the helper set.

from Command
getApplication()

Gets the application instance for this command.

from Command
bool
isEnabled()

Checks whether the command is enabled or not in the current environment.

from Command
configure()

Configures the current command.

int|null
execute(InputInterface $input, OutputInterface $output)

Executes the current command.

interact(InputInterface $input, OutputInterface $output)

Interacts with the user.

from Command
initialize(InputInterface $input, OutputInterface $output)

Initializes the command after the input has been bound and before the input is validated.

from Command
int
run(InputInterface $input, OutputInterface $output)

Runs the command.

from Command
$this
setCode(callable $code)

Sets the code to execute when running this command.

from Command
mergeApplicationDefinition(bool $mergeArgs = true)

Merges the application definition with the command definition.

from Command
$this
setDefinition(array|InputDefinition $definition)

Sets an array of argument and option instances.

from Command
getDefinition()

Gets the InputDefinition attached to this Command.

from Command
getNativeDefinition()

Gets the InputDefinition to be used to create XML and Text representations of this Command.

from Command
$this
addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)

Adds an argument.

from Command
$this
addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)

Adds an option.

from Command
$this
setName(string $name)

Sets the name of the command.

from Command
$this
setProcessTitle(string $title)

Sets the process title of the command.

from Command
string
getName()

Returns the command name.

from Command
$this
setDescription(string $description)

Sets the description for the command.

from Command
string
getDescription()

Returns the description for the command.

from Command
$this
setHelp(string $help)

Sets the help for the command.

from Command
string
getHelp()

Returns the help for the command.

from Command
string
getProcessedHelp()

Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically.

from Command
$this
setAliases(string[] $aliases)

Sets the aliases for the command.

from Command
array
getAliases()

Returns the aliases for the command.

from Command
string
getSynopsis(bool $short = false)

Returns the synopsis for the command.

from Command
$this
addUsage(string $usage)

Add a command usage example.

from Command
array
getUsages()

Returns alternative usages of the command.

from Command
mixed
getHelper(string $name)

Gets a helper instance by name.

from Command
string
asText() deprecated

Returns a text representation of the command.

from Command
string|DOMDocument
asXml(bool $asDom = false) deprecated

Returns an XML representation of the command.

from Command
setContainer(ContainerInterface $container = null)

Sets the container.

Details

in Command at line 55
__construct(string|null $name = null)

Parameters

string|null $name The name of the command; passing null means it must be set in configure()

Exceptions

LogicException When the command name is empty

in Command at line 75
ignoreValidationErrors()

Ignores validation errors.

This is mainly useful for the help command.

in Command at line 80
setApplication(Application $application = null)

Parameters

Application $application

in Command at line 90
setHelperSet(HelperSet $helperSet)

Parameters

HelperSet $helperSet

in Command at line 100
HelperSet getHelperSet()

Gets the helper set.

Return Value

HelperSet A HelperSet instance

in Command at line 110
Application getApplication()

Gets the application instance for this command.

Return Value

Application An Application instance

in Command at line 123
bool isEnabled()

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.

Return Value

bool

at line 34
protected configure()

Configures the current command.

at line 71
protected int|null execute(InputInterface $input, OutputInterface $output)

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

InputInterface $input
OutputInterface $output

Return Value

int|null null or 0 if everything went fine, or an error code

Exceptions

LogicException When this abstract method is not implemented

in Command at line 161
protected interact(InputInterface $input, OutputInterface $output)

Interacts with the user.

This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments.

Parameters

InputInterface $input
OutputInterface $output

in Command at line 175
protected initialize(InputInterface $input, OutputInterface $output)

Initializes the command after the input has been bound and before the input is validated.

This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.

Parameters

InputInterface $input
OutputInterface $output

See also

in Command at line 193
int run(InputInterface $input, OutputInterface $output)

Runs the command.

The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class.

Parameters

InputInterface $input
OutputInterface $output

Return Value

int The command exit code

Exceptions

Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.

See also

in Command at line 265
$this setCode(callable $code)

Sets the code to execute when running this command.

If this method is used, it overrides the code defined in the execute() method.

Parameters

callable $code A callable(InputInterface $input, OutputInterface $output)

Return Value

$this

Exceptions

InvalidArgumentException

See also

in Command at line 298
mergeApplicationDefinition(bool $mergeArgs = true)

Merges the application definition with the command definition.

This method is not part of public API and should not be used directly.

Parameters

bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments

in Command at line 325
$this setDefinition(array|InputDefinition $definition)

Sets an array of argument and option instances.

Parameters

array|InputDefinition $definition An array of argument and option instances or a definition instance

Return Value

$this

in Command at line 343
InputDefinition getDefinition()

Gets the InputDefinition attached to this Command.

Return Value

InputDefinition An InputDefinition instance

in Command at line 358
InputDefinition getNativeDefinition()

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.

Return Value

InputDefinition An InputDefinition instance

in Command at line 375
$this addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null)

Adds an argument.

Parameters

string $name The argument name
int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
string $description A description text
string|string[]|null $default The default value (for self::OPTIONAL mode only)

Return Value

$this

Exceptions

InvalidArgumentException When argument mode is not valid

in Command at line 395
$this addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null)

Adds an option.

Parameters

string $name The option name
string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
int|null $mode The option mode: One of the VALUE_* constants
string $description A description text
string|string[]|bool|null $default The default value (must be null for self::VALUE_NONE)

Return Value

$this

Exceptions

InvalidArgumentException If option mode is invalid or incompatible

in Command at line 416
$this setName(string $name)

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

string $name The command name

Return Value

$this

Exceptions

InvalidArgumentException When the name is invalid

in Command at line 437
$this setProcessTitle(string $title)

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

string $title The process title

Return Value

$this

in Command at line 449
string getName()

Returns the command name.

Return Value

string The command name

in Command at line 461
$this setDescription(string $description)

Sets the description for the command.

Parameters

string $description The description for the command

Return Value

$this

in Command at line 473
string getDescription()

Returns the description for the command.

Return Value

string The description for the command

in Command at line 485
$this setHelp(string $help)

Sets the help for the command.

Parameters

string $help The help for the command

Return Value

$this

in Command at line 497
string getHelp()

Returns the help for the command.

Return Value

string The help for the command

in Command at line 508
string getProcessedHelp()

Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically.

Return Value

string The processed help for the command

in Command at line 533
$this setAliases(string[] $aliases)

Sets the aliases for the command.

Parameters

string[] $aliases An array of aliases for the command

Return Value

$this

Exceptions

InvalidArgumentException When an alias is invalid

in Command at line 553
array getAliases()

Returns the aliases for the command.

Return Value

array An array of aliases for the command

in Command at line 565
string getSynopsis(bool $short = false)

Returns the synopsis for the command.

Parameters

bool $short Whether to show the short version of the synopsis (with options folded) or not

Return Value

string The synopsis

in Command at line 583
$this addUsage(string $usage)

Add a command usage example.

Parameters

string $usage The usage, it'll be prefixed with the command name

Return Value

$this

in Command at line 599
array getUsages()

Returns alternative usages of the command.

Return Value

array

in Command at line 614
mixed getHelper(string $name)

Gets a helper instance by name.

Parameters

string $name The helper name

Return Value

mixed The helper value

Exceptions

LogicException if no HelperSet is defined
InvalidArgumentException if the helper is not defined

in Command at line 630
string asText() deprecated

deprecated since version 2.3, to be removed in 3.0.

Returns a text representation of the command.

Return Value

string A string representing the command

in Command at line 650
string|DOMDocument asXml(bool $asDom = false) deprecated

deprecated since version 2.3, to be removed in 3.0.

Returns an XML representation of the command.

Parameters

bool $asDom Whether to return a DOM or an XML string

Return Value

string|DOMDocument An XML string representing the command

in ContainerAwareCommand at line 35
protected ContainerInterface getContainer()

Return Value

ContainerInterface

Exceptions

LogicException

in ContainerAwareCommand at line 52
setContainer(ContainerInterface $container = null)

Sets the container.

Parameters

ContainerInterface $container