[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

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

(no description)

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

Defines 1 class

Application:: (49 methods):
  __construct()
  setDispatcher()
  setCommandLoader()
  run()
  doRun()
  setHelperSet()
  getHelperSet()
  setDefinition()
  getDefinition()
  getHelp()
  areExceptionsCaught()
  setCatchExceptions()
  isAutoExitEnabled()
  setAutoExit()
  getName()
  setName()
  getVersion()
  setVersion()
  getLongVersion()
  register()
  addCommands()
  add()
  get()
  has()
  getNamespaces()
  findNamespace()
  find()
  all()
  getAbbreviations()
  renderException()
  doRenderException()
  getTerminalWidth()
  getTerminalHeight()
  getTerminalDimensions()
  setTerminalDimensions()
  configureIO()
  doRunCommand()
  getCommandName()
  getDefaultInputDefinition()
  getDefaultCommands()
  getDefaultHelperSet()
  getAbbreviationSuggestions()
  extractNamespace()
  findAlternatives()
  setDefaultCommand()
  isSingleCommand()
  splitStringByWidth()
  extractAllNamespaces()
  init()


Class: Application  - X-Ref

An Application is the container for a collection of commands.

It is the main entry point of a Console application.

This class is optimized for a standard CLI environment.

Usage:

$app = new Application('myapp', '1.0 (stable)');
$app->add(new SimpleCommand());
$app->run();

__construct($name = 'UNKNOWN', $version = 'UNKNOWN')   X-Ref

param: string $name    The name of the application
param: string $version The version of the application

setDispatcher(EventDispatcherInterface $dispatcher)   X-Ref
No description

setCommandLoader(CommandLoaderInterface $commandLoader)   X-Ref
No description

run(InputInterface $input = null, OutputInterface $output = null)   X-Ref
Runs the current application.

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

doRun(InputInterface $input, OutputInterface $output)   X-Ref
Runs the current application.

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

setHelperSet(HelperSet $helperSet)   X-Ref
No description

getHelperSet()   X-Ref
Get the helper set associated with the command.

return: HelperSet The HelperSet instance associated with this command

setDefinition(InputDefinition $definition)   X-Ref
No description

getDefinition()   X-Ref
Gets the InputDefinition related to this Application.

return: InputDefinition The InputDefinition instance

getHelp()   X-Ref
Gets the help message.

return: string A help message

areExceptionsCaught()   X-Ref
Gets whether to catch exceptions or not during commands execution.

return: bool Whether to catch exceptions or not during commands execution

setCatchExceptions($boolean)   X-Ref
Sets whether to catch exceptions or not during commands execution.

param: bool $boolean Whether to catch exceptions or not during commands execution

isAutoExitEnabled()   X-Ref
Gets whether to automatically exit after a command execution or not.

return: bool Whether to automatically exit after a command execution or not

setAutoExit($boolean)   X-Ref
Sets whether to automatically exit after a command execution or not.

param: bool $boolean Whether to automatically exit after a command execution or not

getName()   X-Ref
Gets the name of the application.

return: string The application name

setName($name)   X-Ref
Sets the application name.

param: string $name The application name

getVersion()   X-Ref
Gets the application version.

return: string The application version

setVersion($version)   X-Ref
Sets the application version.

param: string $version The application version

getLongVersion()   X-Ref
Returns the long version of the application.

return: string The long application version

register($name)   X-Ref
Registers a new command.

return: Command The newly created command
param: string $name The command name

addCommands(array $commands)   X-Ref
Adds an array of command objects.

If a Command is not enabled it will not be added.

param: Command[] $commands An array of commands

add(Command $command)   X-Ref
Adds a command object.

If a command with the same name already exists, it will be overridden.
If the command is not enabled it will not be added.

return: Command|null The registered command if enabled or null

get($name)   X-Ref
Returns a registered command by name or alias.

return: Command A Command object
param: string $name The command name or alias

has($name)   X-Ref
Returns true if the command exists, false otherwise.

return: bool true if the command exists, false otherwise
param: string $name The command name or alias

getNamespaces()   X-Ref
Returns an array of all unique namespaces used by currently registered commands.

It does not return the global namespace which always exists.

return: string[] An array of namespaces

findNamespace($namespace)   X-Ref
Finds a registered namespace by a name or an abbreviation.

return: string A registered namespace
param: string $namespace A namespace or abbreviation to search for

find($name)   X-Ref
Finds a command by name or alias.

Contrary to get, this command tries to find the best
match if you give it an abbreviation of a name or alias.

return: Command A Command instance
param: string $name A command name or a command alias

all($namespace = null)   X-Ref
Gets the commands (registered in the given namespace if provided).

The array keys are the full names and the values the command instances.

return: Command[] An array of Command instances
param: string $namespace A namespace name

getAbbreviations($names)   X-Ref
Returns an array of possible abbreviations given a set of names.

return: array An array of abbreviations
param: array $names An array of names

renderException(\Exception $e, OutputInterface $output)   X-Ref
Renders a caught exception.


doRenderException(\Exception $e, OutputInterface $output)   X-Ref
No description

getTerminalWidth()   X-Ref
Tries to figure out the terminal width in which this application runs.

return: int|null

getTerminalHeight()   X-Ref
Tries to figure out the terminal height in which this application runs.

return: int|null

getTerminalDimensions()   X-Ref
Tries to figure out the terminal dimensions based on the current environment.

return: array Array containing width and height

setTerminalDimensions($width, $height)   X-Ref
Sets terminal dimensions.

Can be useful to force terminal dimensions for functional tests.

return: $this
param: int $width  The width
param: int $height The height

configureIO(InputInterface $input, OutputInterface $output)   X-Ref
Configures the input and output instances based on the user arguments and options.


doRunCommand(Command $command, InputInterface $input, OutputInterface $output)   X-Ref
Runs the current command.

If an event dispatcher has been attached to the application,
events are also dispatched during the life-cycle of the command.

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

getCommandName(InputInterface $input)   X-Ref
Gets the name of the command based on input.

return: string|null

getDefaultInputDefinition()   X-Ref
Gets the default input definition.

return: InputDefinition An InputDefinition instance

getDefaultCommands()   X-Ref
Gets the default commands that should always be available.

return: Command[] An array of default Command instances

getDefaultHelperSet()   X-Ref
Gets the default helper set with the helpers that should always be available.

return: HelperSet A HelperSet instance

getAbbreviationSuggestions($abbrevs)   X-Ref
Returns abbreviated suggestions in string format.

return: string A formatted string of abbreviated suggestions
param: array $abbrevs Abbreviated suggestions to convert

extractNamespace($name, $limit = null)   X-Ref
Returns the namespace part of the command name.

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

return: string The namespace of the command
param: string $name  The full name of the command
param: string $limit The maximum number of parts of the namespace

findAlternatives($name, $collection)   X-Ref
Finds alternative of $name among $collection,
if nothing is found in $collection, try in $abbrevs.

return: string[] A sorted array of similar string
param: string   $name       The string
param: iterable $collection The collection

setDefaultCommand($commandName, $isSingleCommand = false)   X-Ref
Sets the default Command name.

return: self
param: string $commandName     The Command name
param: bool   $isSingleCommand Set to true if there is only one command in this application

isSingleCommand()   X-Ref


splitStringByWidth($string, $width)   X-Ref
No description

extractAllNamespaces($name)   X-Ref
Returns all namespaces of the command name.

return: string[] The namespaces of the command
param: string $name The full name of the command

init()   X-Ref
No description



Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1