Class \Prado\Shell\TShellApplication
TShellApplication class.
TShellApplication is the base class for developing command-line PRADO tools that share the same configurations as their Web application counterparts.
A typical usage of TShellApplication in a command-line PHP script is as follows:
require 'path/to/vendor/autoload.php';
$application=new TShellApplication('path/to/application.xml');
$application->run($_SERVER);
// perform command-line tasks here
Since the application instance has access to all configurations, including path aliases, modules and parameters, the command-line script has nearly the same accessibility to resources as the PRADO Web applications.
Class hierarchy
Author: Qiang Xue <qiang.xue@gmail.com>Author: Brad Anderson <belisoful@icloud.com> shell refactor
Since: 3.1.0
public
|
|
public
static
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
processActionArguments(array<string|int, mixed> &$args, TShellAction $action, string $method) : mixed
This processes the arguments entered into the cli
|
public
|
processArguments(object $sender, mixed $param) : mixed
This processes the arguments entered into the cli. This is processed after
the application is initialized and modules can
|
public
|
registerOption(string $name, callable $setCallback[, string $description = '' ][, string $values = '' ]) : mixed
This registers shell command line options and the setter callback
|
public
|
registerOptionAlias(string $alias, string $name) : mixed
This registers shell command line option aliases and linked variable
|
public
|
run([null|array<string|int, string> $args = null ]) : mixed
Runs the application.
This method overrides the parent implementation by initializing application with configurations specified when it is created. |
public
|
|
public
|
|
public
|
|
private
|
detectShellLanguageCharset() : mixed
This takes the shell LANG and sets the HTTP_ACCEPT_LANGUAGE/HTTP_ACCEPT_CHARSET
for the application to do I18N.
|