Methods summary
public
|
#
__construct( array|ArrayAccess $data = null )
Return a new CLI script.
Parameters
- $data
- The dependencies (app and logger).
|
public
|
#
setDependencies( Pimple\Container $container )
Give an opportunity to children classes to inject dependencies from a Pimple Container.
Give an opportunity to children classes to inject dependencies from a Pimple Container.
Does nothing by default, reimplement in children classes.
The $container DI-container (from Pimple ) should not be saved or passed around, only to be used to
inject dependencies (typically via setters).
Parameters
- $container
- A dependencies container instance.
Implementation of
|
protected
|
|
final public
Psr\Http\Message\ResponseInterface
|
#
__invoke( Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response )
Parameters
- $request
- A PSR-7 compatible Request instance.
- $response
- A PSR-7 compatible Response instance.
Returns
Psr\Http\Message\ResponseInterface
|
protected
League\CLImate\CLImate
|
#
climate( )
Safe climate getter.
If the instance was not previously set, create it.
Safe climate getter.
If the instance was not previously set, create it.
CLImate is "PHP's best friend for the terminal."
"CLImate allows you to easily output colored text, special formats, and more."
Returns
League\CLImate\CLImate
|
protected
League\CLImate\Util\Reader\ReaderInterface
|
|
public
array
|
#
defaultArguments( )
Retrieve the script's supported arguments.
Retrieve the script's supported arguments.
Returns
array
|
public
Charcoal\App\Script\ScriptInterface
|
#
setIdent( string $ident )
Parameters
- $ident
- The script identifier string.
Returns
Throws
InvalidArgumentException If the ident argument is not a string.
Implementation of
|
public
string
|
#
ident( )
Returns
string
Implementation of
|
public
Charcoal\App\Script\ScriptInterface
|
#
setDescription( string $description )
Parameters
- $description
- The script description.
Returns
Throws
InvalidArgumentException If the deescription parameter is not a string.
Implementation of
|
public
string
|
|
public
Charcoal\App\Script\ScriptInterface
|
|
public
boolean
|
|
public
Charcoal\App\Script\ScriptInterface
|
#
setVerbose( boolean $verbose )
Parameters
- $verbose
- The verbose flag.
Returns
|
public
boolean
|
|
public
Charcoal\App\Script\ScriptInterface
|
#
setInteractive( boolean $interactive )
Parameters
- $interactive
- The interactive flag.
Returns
|
public
boolean
|
|
public
Charcoal\App\Script\ScriptInterface
|
#
setDryRun( boolean $simulate )
Parameters
- $simulate
- The dry-run flag.
Returns
|
public
boolean
|
|
public
Charcoal\App\Script\ScriptInterface
|
#
setArguments( array $arguments )
Parameters
- $arguments
- The scripts argument array, as [key=>value].
Returns
Implementation of
|
public
Charcoal\App\Script\ScriptInterface
|
#
addArgument( string $argumentIdent, array $argument )
Parameters
- $argumentIdent
- The argument identifier.
- $argument
- The argument options.
Returns
Throws
InvalidArgumentException If the argument ident is not a string.
Implementation of
|
public
array
|
#
arguments( )
Returns
array $arguments
Implementation of
|
public
array|null
|
#
argument( string $argumentIdent )
Parameters
- $argumentIdent
- The argument identifier to retrieve options from.
Returns
array|null The argument options, or null if it does not exist.
Implementation of
|
protected
mixed
|
#
argOrInput( string $argName )
Retrieve an argument either from argument list (if set) or from user input.
Retrieve an argument either from argument list (if set) or from user input.
Parameters
- $argName
- An argument identifier.
Returns
mixed Returns the argument or prompt value.
|
protected
mixed
|
#
input( string $name )
Request a value from the user for the given argument.
Request a value from the user for the given argument.
Parameters
- $name
- An argument identifier.
Returns
mixed Returns the prompt value.
Throws
RuntimeException If a radio or checkbox prompt has no options.
|