[ Index ]

PHP Cross Reference of phpBB-3.3.12-deutsch

title

Body

[close]

/vendor/symfony/console/Command/ -> Command.php (summary)

(no description)

File Size: 666 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Command:: (37 methods):
  getDefaultName()
  __construct()
  ignoreValidationErrors()
  setApplication()
  setHelperSet()
  getHelperSet()
  getApplication()
  isEnabled()
  configure()
  execute()
  interact()
  initialize()
  run()
  setCode()
  mergeApplicationDefinition()
  setDefinition()
  getDefinition()
  getNativeDefinition()
  addArgument()
  addOption()
  setName()
  setProcessTitle()
  getName()
  setHidden()
  isHidden()
  setDescription()
  getDescription()
  setHelp()
  getHelp()
  getProcessedHelp()
  setAliases()
  getAliases()
  getSynopsis()
  addUsage()
  getUsages()
  getHelper()
  validateName()


Class: Command  - X-Ref

Base class for all commands.

getDefaultName()   X-Ref

return: string|null The default command name or null when no default name is set

__construct($name = null)   X-Ref

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

ignoreValidationErrors()   X-Ref
Ignores validation errors.

This is mainly useful for the help command.

setApplication(Application $application = null)   X-Ref
No description

setHelperSet(HelperSet $helperSet)   X-Ref
No description

getHelperSet()   X-Ref
Gets the helper set.

return: HelperSet|null A HelperSet instance

getApplication()   X-Ref
Gets the application instance for this command.

return: Application|null An Application instance

isEnabled()   X-Ref
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: bool

configure()   X-Ref
Configures the current command.


execute(InputInterface $input, OutputInterface $output)   X-Ref
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.

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

interact(InputInterface $input, OutputInterface $output)   X-Ref
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.

initialize(InputInterface $input, OutputInterface $output)   X-Ref
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.


run(InputInterface $input, OutputInterface $output)   X-Ref
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.

return: int The command exit code

setCode(callable $code)   X-Ref
Sets the code to execute when running this command.

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

return: $this
param: callable $code A callable(InputInterface $input, OutputInterface $output)

mergeApplicationDefinition($mergeArgs = true)   X-Ref
Merges the application definition with the command definition.

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

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

setDefinition($definition)   X-Ref
Sets an array of argument and option instances.

return: $this
param: array|InputDefinition $definition An array of argument and option instances or a definition instance

getDefinition()   X-Ref
Gets the InputDefinition attached to this Command.

return: InputDefinition An InputDefinition instance

getNativeDefinition()   X-Ref
Gets the InputDefinition to be used to create 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: InputDefinition An InputDefinition instance

addArgument($name, $mode = null, $description = '', $default = null)   X-Ref
Adds an argument.

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

addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)   X-Ref
Adds an option.

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

setName($name)   X-Ref
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');

return: $this
param: string $name The command name

setProcessTitle($title)   X-Ref
Sets the process title of the command.

This feature should be used only when creating a long process command,
like a daemon.

return: $this
param: string $title The process title

getName()   X-Ref
Returns the command name.

return: string|null

setHidden($hidden)   X-Ref

return: Command The current instance
param: bool $hidden Whether or not the command should be hidden from the list of commands

isHidden()   X-Ref

return: bool whether the command should be publicly shown or not

setDescription($description)   X-Ref
Sets the description for the command.

return: $this
param: string $description The description for the command

getDescription()   X-Ref
Returns the description for the command.

return: string The description for the command

setHelp($help)   X-Ref
Sets the help for the command.

return: $this
param: string $help The help for the command

getHelp()   X-Ref
Returns the help for the command.

return: string The help for the command

getProcessedHelp()   X-Ref
Returns the processed help for the command replacing the %command.name% and
%command.full_name% patterns with the real values dynamically.

return: string The processed help for the command

setAliases($aliases)   X-Ref
Sets the aliases for the command.

return: $this
param: string[] $aliases An array of aliases for the command

getAliases()   X-Ref
Returns the aliases for the command.

return: array An array of aliases for the command

getSynopsis($short = false)   X-Ref
Returns the synopsis for the command.

return: string The synopsis
param: bool $short Whether to show the short version of the synopsis (with options folded) or not

addUsage($usage)   X-Ref
Add a command usage example.

return: $this
param: string $usage The usage, it'll be prefixed with the command name

getUsages()   X-Ref
Returns alternative usages of the command.

return: array

getHelper($name)   X-Ref
Gets a helper instance by name.

return: mixed The helper value
param: string $name The helper name

validateName($name)   X-Ref
Validates a command name.

It must be non-empty and parts can optionally be separated by ":".

param: string $name



Generated: Sun Jun 23 12:25:44 2024 Cross-referenced by PHPXref 0.7.1