Methods |
public
|
getProgramName(): string
Get the name of the file used to run the application
Get the name of the file used to run the application
Implemented by
|
#
|
public
|
getRunningCommand(): ?CliCommandInterface
Get the command invoked by run()
Get the command invoked by run()
This method should only return a command that is currently running.
Implemented by
|
#
|
public
|
getLastCommand(): ?CliCommandInterface
Get the command most recently invoked by run()
Get the command most recently invoked by run()
This method should only return a command that ran to completion or failed
with an exception.
Implemented by
|
#
|
public
|
getLastExitStatus(): int
Get the return value most recently recorded by run()
Get the return value most recently recorded by run()
This method should return 0 if a return value has not been recorded.
Implemented by
|
#
|
public
|
command(string[] $name, class-string<CliCommandInterface> $id): $this
Register a command with the container
Register a command with the container
Parameters
$name |
The name of the command as an array of subcommands.
Valid subcommands start with a letter, followed by any number of letters,
numbers, hyphens and underscores.
|
Throws
LogicException |
if $name is invalid or conflicts with a
registered command.
|
Implemented by
|
#
|
public
|
oneCommand(class-string<CliCommandInterface> $id): $this
Register one, and only one, command for the lifetime of the container
Register one, and only one, command for the lifetime of the container
Calling this method should have the same effect as calling
{@see CliApplicationInterface::command()} with an empty command name.
Throws
Implemented by
|
#
|
public
|
run(): $this
Process command line arguments passed to the script and record a return
value
Process command line arguments passed to the script and record a return
value
This method should take the first applicable action:
-
If --help is the only remaining argument after processing subcommand
arguments, print a help message to STDOUT . Return value: 0
-
If --version is the only remaining argument, print the application's
name, version and commit reference to STDOUT , followed by the PHP
version. Return value: 0
-
If subcommand arguments resolve to a registered command, create an
instance of the command and run it. Return value: command exit status
-
If, after processing subcommand arguments, there are no further
arguments but there are further subcommands, print a one-line synopsis
of each registered subcommand. Return value: 0
-
Report an error and print a one-line synopsis of each registered
subcommand. Return value: 1
Implemented by
|
#
|
public
|
exit(): never
Exit with the return value most recently recorded by run()
Exit with the return value most recently recorded by run()
This method should use exit status 0 if a return value has not been
recorded.
Implemented by
|
#
|
public
|
runAndExit(): never
Process command line arguments passed to the script and exit with the
recorded return value
Process command line arguments passed to the script and exit with the
recorded return value
See {@see CliApplicationInterface::run()} for details.
Implemented by
|
#
|
public
|
reportVersion(MessageLevel::* $level = MessageLevel::INFO, bool $stdout = false): $this
Print the application's name, version and commit reference, followed by
the PHP version
Print the application's name, version and commit reference, followed by
the PHP version
Implemented by
|
#
|
public
|
getVersionString(): string
Get the application's name, version and commit reference, followed by the
PHP version
Get the application's name, version and commit reference, followed by the
PHP version
This method should return the string that
{@see CliApplicationInterface::reportVersion()} would print.
Implemented by
|
#
|