MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
Referência à classe Application

Membros públicos

 __construct ($name='UNKNOWN', $version='UNKNOWN')
 
 run (InputInterface $input=null, OutputInterface $output=null)
 
 doRun (InputInterface $input, OutputInterface $output)
 
 setHelperSet (HelperSet $helperSet)
 
 getHelperSet ()
 
 getDefinition ()
 
 getHelp ()
 
 setCatchExceptions ($boolean)
 
 setAutoExit ($boolean)
 
 getName ()
 
 setName ($name)
 
 getVersion ()
 
 setVersion ($version)
 
 getLongVersion ()
 
 register ($name)
 
 addCommands (array $commands)
 
 add (Command $command)
 
 get ($name)
 
 has ($name)
 
 getNamespaces ()
 
 findNamespace ($namespace)
 
 find ($name)
 
 all ($namespace=null)
 
 asText ($namespace=null)
 
 asXml ($namespace=null, $asDom=false)
 
 renderException ($e, $output)
 

Membros públicos estáticos

static getAbbreviations ($names)
 

Membros protegidos

 getCommandName (InputInterface $input)
 
 sortCommands ($commands)
 
 getAbbreviationSuggestions ($abbrevs)
 

Atributos Protegidos

 $commands
 
 $aliases
 
 $wantHelps = false
 
 $runningCommand
 
 $name
 
 $version
 
 $catchExceptions
 
 $autoExit
 
 $definition
 
 $helperSet
 

Descrição detalhada

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();
Autor
Fabien Potencier fabie.nosp@m.n.po.nosp@m.tenci.nosp@m.er@s.nosp@m.ymfon.nosp@m.y-pr.nosp@m.oject.nosp@m..com

Definido na linha 45 do ficheiro Application.php.

Documentação dos Construtores & Destrutor

◆ __construct()

__construct ( $name = 'UNKNOWN',
$version = 'UNKNOWN' )

Constructor.

Parâmetros
string$nameThe name of the application
string$versionThe version of the application

Definido na linha 64 do ficheiro Application.php.

Documentação das funções

◆ add()

add ( Command $command)

Adds a command object.

If a command with the same name already exists, it will be overridden.

Parâmetros
Command$commandA Command object
Retorna
Command The registered command

Definido na linha 356 do ficheiro Application.php.

◆ addCommands()

addCommands ( array $commands)

Adds an array of command objects.

Parâmetros
Command[]$commandsAn array of commands

Definido na linha 340 do ficheiro Application.php.

◆ all()

all ( $namespace = null)

Gets the commands (registered in the given namespace if provided).

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

Parâmetros
string$namespaceA namespace name
Retorna
array An array of Command instances

Definido na linha 515 do ficheiro Application.php.

◆ asText()

asText ( $namespace = null)

Returns a text representation of the Application.

Parâmetros
string$namespaceAn optional namespace name
Retorna
string A string representing the Application

Definido na linha 567 do ficheiro Application.php.

◆ asXml()

asXml ( $namespace = null,
$asDom = false )

Returns an XML representation of the Application.

Parâmetros
string$namespaceAn optional namespace name
Boolean$asDomWhether to return a DOM or an XML string
Retorna
string|DOMDocument An XML string representing the Application

Definido na linha 608 do ficheiro Application.php.

◆ doRun()

doRun ( InputInterface $input,
OutputInterface $output )

Runs the current application.

Parâmetros
InputInterface$inputAn Input instance
OutputInterface$outputAn Output instance
Retorna
integer 0 if everything went fine, or an error code

Definido na linha 145 do ficheiro Application.php.

◆ find()

find ( $name)

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.

Parâmetros
string$nameA command name or a command alias
Retorna
Command A Command instance
Excepções

InvalidArgumentException When command name is incorrect or ambiguous

Definido na linha 463 do ficheiro Application.php.

◆ findNamespace()

findNamespace ( $namespace)

Finds a registered namespace by a name or an abbreviation.

Retorna
string A registered namespace
Excepções

InvalidArgumentException When namespace is incorrect or ambiguous

Definido na linha 436 do ficheiro Application.php.

◆ get()

get ( $name)

Returns a registered command by name or alias.

Parâmetros
string$nameThe command name or alias
Retorna
Command A Command object
Excepções

InvalidArgumentException When command name given does not exist

Definido na linha 378 do ficheiro Application.php.

◆ getAbbreviations()

static getAbbreviations ( $names)
static

Returns an array of possible abbreviations given a set of names.

Parâmetros
array$namesAn array of names
Retorna
array An array of abbreviations

Definido na linha 538 do ficheiro Application.php.

◆ getAbbreviationSuggestions()

getAbbreviationSuggestions ( $abbrevs)
protected

Definido na linha 739 do ficheiro Application.php.

◆ getCommandName()

getCommandName ( InputInterface $input)
protected

Definido na linha 713 do ficheiro Application.php.

◆ getDefinition()

getDefinition ( )

Gets the InputDefinition related to this Application.

Retorna
InputDefinition The InputDefinition instance

Definido na linha 218 do ficheiro Application.php.

◆ getHelp()

getHelp ( )

Gets the help message.

Retorna
string A help message.

Definido na linha 228 do ficheiro Application.php.

◆ getHelperSet()

getHelperSet ( )

Get the helper set associated with the command

Retorna
HelperSet The HelperSet instance associated with this command

Definido na linha 208 do ficheiro Application.php.

◆ getLongVersion()

getLongVersion ( )

Returns the long version of the application.

Retorna
string The long application version

Definido na linha 314 do ficheiro Application.php.

◆ getName()

getName ( )

Gets the name of the application.

Retorna
string The application name

Definido na linha 274 do ficheiro Application.php.

◆ getNamespaces()

getNamespaces ( )

Returns an array of all unique namespaces used by currently registered commands.

It does not returns the global namespace which always exists.

Retorna
array An array of namespaces

Definido na linha 417 do ficheiro Application.php.

◆ getVersion()

getVersion ( )

Gets the application version.

Retorna
string The application version

Definido na linha 294 do ficheiro Application.php.

◆ has()

has ( $name)

Returns true if the command exists, false otherwise

Parâmetros
string$nameThe command name or alias
Retorna
Boolean true if the command exists, false otherwise

Definido na linha 405 do ficheiro Application.php.

◆ register()

register ( $name)

Registers a new command.

Parâmetros
string$nameThe command name
Retorna
Command The newly created command

Definido na linha 330 do ficheiro Application.php.

◆ renderException()

renderException ( $e,
$output )

Renders a catched exception.

Parâmetros
Exception$eAn exception instance
OutputInterface$outputAn OutputInterface instance

Definido na linha 653 do ficheiro Application.php.

◆ run()

run ( InputInterface $input = null,
OutputInterface $output = null )

Runs the current application.

Parâmetros
InputInterface$inputAn Input instance
OutputInterface$outputAn Output instance
Retorna
integer 0 if everything went fine, or an error code
Excepções

Exception When doRun returns Exception

Definido na linha 102 do ficheiro Application.php.

◆ setAutoExit()

setAutoExit ( $boolean)

Sets whether to automatically exit after a command execution or not.

Parâmetros
Boolean$booleanWhether to automatically exit after a command execution or not

Definido na linha 264 do ficheiro Application.php.

◆ setCatchExceptions()

setCatchExceptions ( $boolean)

Sets whether to catch exceptions or not during commands execution.

Parâmetros
Boolean$booleanWhether to catch exceptions or not during commands execution

Definido na linha 254 do ficheiro Application.php.

◆ setHelperSet()

setHelperSet ( HelperSet $helperSet)

Set a helper set to be used with the command.

Parâmetros
HelperSet$helperSetThe helper set

Definido na linha 198 do ficheiro Application.php.

◆ setName()

setName ( $name)

Sets the application name.

Parâmetros
string$nameThe application name

Definido na linha 284 do ficheiro Application.php.

◆ setVersion()

setVersion ( $version)

Sets the application version.

Parâmetros
string$versionThe application version

Definido na linha 304 do ficheiro Application.php.

◆ sortCommands()

sortCommands ( $commands)
protected

Definido na linha 718 do ficheiro Application.php.

Documentação dos campos e atributos

◆ $aliases

$aliases
protected

Definido na linha 48 do ficheiro Application.php.

◆ $autoExit

$autoExit
protected

Definido na linha 54 do ficheiro Application.php.

◆ $catchExceptions

$catchExceptions
protected

Definido na linha 53 do ficheiro Application.php.

◆ $commands

$commands
protected

Definido na linha 47 do ficheiro Application.php.

◆ $definition

$definition
protected

Definido na linha 55 do ficheiro Application.php.

◆ $helperSet

$helperSet
protected

Definido na linha 56 do ficheiro Application.php.

◆ $name

$name
protected

Definido na linha 51 do ficheiro Application.php.

◆ $runningCommand

$runningCommand
protected

Definido na linha 50 do ficheiro Application.php.

◆ $version

$version
protected

Definido na linha 52 do ficheiro Application.php.

◆ $wantHelps

$wantHelps = false
protected

Definido na linha 49 do ficheiro Application.php.


A documentação para esta classe foi gerada a partir do seguinte ficheiro: