Console\Application (Bundle\FrameworkBundle)
Symfony\Bundle\FrameworkBundle\Console\Application
class Application extends Application
Application.
Methods
__construct(KernelInterface $kernel) Constructor. | ||
setDispatcher(EventDispatcherInterface $dispatcher) | from Application | |
int | run(InputInterface $input = null, OutputInterface $output = null) Runs the current application. | from Application |
int | doRun(InputInterface $input, OutputInterface $output) Runs the current application. | |
setHelperSet(HelperSet $helperSet) Set a helper set to be used with the command. | from Application | |
HelperSet | getHelperSet() Get the helper set associated with the command. | from Application |
setDefinition(InputDefinition $definition) Set an input definition set to be used with this application. | from Application | |
InputDefinition | getDefinition() Gets the InputDefinition related to this Application. | from Application |
string | getHelp() Gets the help message. | from Application |
setCatchExceptions(bool $boolean) Sets whether to catch exceptions or not during commands execution. | from Application | |
setAutoExit(bool $boolean) Sets whether to automatically exit after a command execution or not. | from Application | |
string | getName() Gets the name of the application. | from Application |
setName(string $name) Sets the application name. | from Application | |
string | getVersion() Gets the application version. | from Application |
setVersion(string $version) Sets the application version. | from Application | |
string | getLongVersion() Returns the long version of the application. | from Application |
Command | register(string $name) Registers a new command. | from Application |
addCommands(array $commands) Adds an array of command objects. | from Application | |
Command | add(Command $command) Adds a command object. | from Application |
Command | get(string $name) Returns a registered command by name or alias. | from Application |
bool | has(string $name) Returns true if the command exists, false otherwise. | from Application |
array | getNamespaces() Returns an array of all unique namespaces used by currently registered commands. | from Application |
string | findNamespace(string $namespace) Finds a registered namespace by a name or an abbreviation. | from Application |
Command | find(string $name) Finds a command by name or alias. | from Application |
Command[] | all(string $namespace = null) Gets the commands (registered in the given namespace if provided). | from Application |
static array | getAbbreviations(array $names) Returns an array of possible abbreviations given a set of names. | from Application |
renderException(Exception $e, OutputInterface $output) Renders a caught exception. | from Application | |
array | getTerminalDimensions() Tries to figure out the terminal dimensions based on the current environment. | from Application |
Application | setTerminalDimensions(int $width, int $height) Sets terminal dimensions. | from Application |
string | extractNamespace(string $name, string $limit = null) Returns the namespace part of the command name. | from Application |
setDefaultCommand(string $commandName) Sets the default Command name. | from Application | |
KernelInterface | getKernel() Gets the Kernel associated with this Console. |
Details
public __construct(KernelInterface $kernel)
Constructor.
public setDispatcher(EventDispatcherInterface $dispatcher)
public int run(InputInterface $input = null, OutputInterface $output = null)
Runs the current application.
public int doRun(InputInterface $input, OutputInterface $output)
Runs the current application.
public setHelperSet(HelperSet $helperSet)
Set a helper set to be used with the command.
public HelperSet getHelperSet()
Get the helper set associated with the command.
public setDefinition(InputDefinition $definition)
Set an input definition set to be used with this application.
public InputDefinition getDefinition()
Gets the InputDefinition related to this Application.
public string getHelp()
Gets the help message.
public setCatchExceptions(bool $boolean)
Sets whether to catch exceptions or not during commands execution.
public setAutoExit(bool $boolean)
Sets whether to automatically exit after a command execution or not.
public string getName()
Gets the name of the application.
public setName(string $name)
Sets the application name.
public string getVersion()
Gets the application version.
public setVersion(string $version)
Sets the application version.
public string getLongVersion()
Returns the long version of the application.
public Command register(string $name)
Registers a new command.
public addCommands(array $commands)
Adds an array of command objects.
public Command add(Command $command)
Adds a command object.
If a command with the same name already exists, it will be overridden.
public Command get(string $name)
Returns a registered command by name or alias.
public bool has(string $name)
Returns true if the command exists, false otherwise.
public array getNamespaces()
Returns an array of all unique namespaces used by currently registered commands.
It does not returns the global namespace which always exists.
public string findNamespace(string $namespace)
Finds a registered namespace by a name or an abbreviation.
public Command find(string $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.
public Command[] all(string $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.
static public array getAbbreviations(array $names)
Returns an array of possible abbreviations given a set of names.
public renderException(Exception $e, OutputInterface $output)
Renders a caught exception.
public array getTerminalDimensions()
Tries to figure out the terminal dimensions based on the current environment.
public Application setTerminalDimensions(int $width, int $height)
Sets terminal dimensions.
Can be useful to force terminal dimensions for functional tests.
public string extractNamespace(string $name, string $limit = null)
Returns the namespace part of the command name.
This method is not part of public API and should not be used directly.
public setDefaultCommand(string $commandName)
Sets the default Command name.
public KernelInterface getKernel()
Gets the Kernel associated with this Console.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Bundle/FrameworkBundle/Console/Application.html