implements |
ResetInterface |
|---|
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();
| Methods | ||
|---|---|---|
public
|
__construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
|
# |
public
|
setDispatcher(EventDispatcherInterface $dispatcher): void
|
# |
public
|
setCommandLoader(CommandLoaderInterface $commandLoader): void
|
# |
public
|
getSignalRegistry(): SignalRegistry
|
# |
public
|
setSignalsToDispatchEvent(int ...$signalsToDispatchEvent): void
|
# |
public
|
run(InputInterface $input = null, OutputInterface $output = null): int
|
# |
public
|
doRun(InputInterface $input, OutputInterface $output): int
|
# |
public
|
reset(): void
|
# |
public
|
setHelperSet(HelperSet $helperSet): void
|
# |
public
|
getHelperSet(): HelperSet
|
# |
public
|
setDefinition(InputDefinition $definition): void
|
# |
public
|
getDefinition(): InputDefinition
|
# |
public
|
complete(CompletionInput $input, CompletionSuggestions $suggestions): void
|
# |
public
|
getHelp(): string
|
# |
public
|
areExceptionsCaught(): bool
|
# |
public
|
setCatchExceptions(bool $boolean): void
|
# |
public
|
isAutoExitEnabled(): bool
|
# |
public
|
setAutoExit(bool $boolean): void
|
# |
public
|
getName(): string
|
# |
public
|
setName(string $name): void
|
# |
public
|
getVersion(): string
|
# |
public
|
setVersion(string $version): void
|
# |
public
|
getLongVersion(): string
|
# |
public
|
register(string $name): Command
|
# |
public
|
addCommands(Command[] $commands): void
|
# |
public
|
add(Command $command): Command|null
|
# |
public
|
get(string $name): Command
|
# |
public
|
has(string $name): bool
|
# |
public
|
getNamespaces(): string[]
|
# |
public
|
findNamespace(string $namespace): string
|
# |
public
|
find(string $name): Command
|
# |
public
|
all(string $namespace = null): Command[]
|
# |
public
static
|
getAbbreviations(array $names): string[][]
|
# |
public
|
renderThrowable(Throwable $e, OutputInterface $output): void
|
# |
protected
|
doRenderThrowable(Throwable $e, OutputInterface $output): void
|
# |
protected
|
configureIO(InputInterface $input, OutputInterface $output): void
|
# |
protected
|
doRunCommand(Command $command, InputInterface $input, OutputInterface $output): int
|
# |
protected
|
getCommandName(InputInterface $input): ?string
|
# |
protected
|
getDefaultInputDefinition(): InputDefinition
|
# |
protected
|
getDefaultCommands(): Command[]
|
# |
protected
|
getDefaultHelperSet(): HelperSet
|
# |
private
|
getAbbreviationSuggestions(array $abbrevs): string
|
# |
public
|
extractNamespace(string $name, int $limit = null): string
|
# |
private
|
findAlternatives(string $name, iterable $collection): string[]
|
# |
public
|
setDefaultCommand(string $commandName, bool $isSingleCommand = false): $this
|
# |
private
|
splitStringByWidth(string $string, int $width): array
|
# |
private
|
extractAllNamespaces(string $name): string[]
|
# |
private
|
init(): void
|
# |
| Properties | |||
|---|---|---|---|
private
|
array
|
$commands = []
|
# |
private
|
bool
|
$wantHelps = false
|
# |
private
|
?Command
|
$runningCommand = null
|
# |
private
|
string
|
$name
|
# |
private
|
string
|
$version
|
# |
private
|
?CommandLoaderInterface
|
$commandLoader = null
|
# |
private
|
bool
|
$catchExceptions = true
|
# |
private
|
bool
|
$autoExit = true
|
# |
private
|
InputDefinition
|
$definition
|
# |
private
|
HelperSet
|
$helperSet
|
# |
private
|
?EventDispatcherInterface
|
$dispatcher = null
|
# |
private
|
Terminal
|
$terminal
|
# |
private
|
string
|
$defaultCommand
|
# |
private
|
bool
|
$singleCommand = false
|
# |
private
|
bool
|
$initialized = false
|
# |
private
|
?SignalRegistry
|
$signalRegistry = null
|
# |
private
|
array
|
$signalsToDispatchEvent = []
|
# |