[ Index ]

PHP Cross Reference of phpBB-3.2.8-deutsch

title

Body

[close]

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

(no description)

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

Defines 1 class

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


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

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

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

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.

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

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.

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

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

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

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.

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

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.

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

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.

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

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

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

asText($namespace = null, $raw = false)   X-Ref
Returns a text representation of the Application.

param: string $namespace An optional namespace name
param: bool   $raw       Whether to return raw command list
return: string A string representing the Application

asXml($namespace = null, $asDom = false)   X-Ref
Returns an XML representation of the Application.

param: string $namespace An optional namespace name
param: bool   $asDom     Whether to return a DOM or an XML string
return: string|\DOMDocument An XML string representing the Application

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


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.

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

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 The command name

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

getSttyColumns()   X-Ref
Runs and parses stty -a if it's available, suppressing any error output.

return: string

getConsoleMode()   X-Ref
Runs and parses mode CON if it's available, suppressing any error output.

return: string|null <width>x<height> or null if it could not be parsed

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

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

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.

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

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

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

setDefaultCommand($commandName)   X-Ref
Sets the default Command name.

param: string $commandName The Command name

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

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

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

init()   X-Ref
No description

getExitCodeForThrowable($throwable)   X-Ref

param: \Exception|\Throwable $throwable
return: int



Generated: Tue Apr 7 19:42:26 2020 Cross-referenced by PHPXref 0.7.1