[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

(no description)

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

Defines 1 class

Command:: (39 methods):
  getDefaultName()
  getDefaultDescription()
  __construct()
  ignoreValidationErrors()
  setApplication()
  setHelperSet()
  getHelperSet()
  getApplication()
  isEnabled()
  configure()
  execute()
  interact()
  initialize()
  run()
  complete()
  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

getDefaultDescription()   X-Ref
No description

__construct(string $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

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

return: Application|null

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 cannot
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 0 if everything went fine, or an exit 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

complete(CompletionInput $input, CompletionSuggestions $suggestions)   X-Ref
Adds suggestions to $suggestions for the current completion input (e.g. option or argument).


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.

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

mergeApplicationDefinition(bool $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.

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

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

return: InputDefinition

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

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

param: int|null $mode    The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
param: mixed    $default The default value (for InputArgument::OPTIONAL mode only)
return: $this

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

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: mixed             $default  The default value (must be null for InputOption::VALUE_NONE)
return: $this

setName(string $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

setProcessTitle(string $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

getName()   X-Ref
Returns the command name.

return: string|null

setHidden(bool $hidden )   X-Ref

param: bool $hidden Whether or not the command should be hidden from the list of commands
return: $this

isHidden()   X-Ref

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

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

return: $this

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

return: string

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

return: $this

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

return: string

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

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

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

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

return: array

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

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

addUsage(string $usage)   X-Ref
Add a command usage example, it'll be prefixed with the command name.

return: $this

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

return: array

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

return: mixed

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

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




Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer