AvailableCommand
extends Command
in package
Table of Contents
Properties
- $cli : CLImate
- Instance of the command line interface
- $description : string
- The commands decsription displayed when listening commands or in the help dialog
- $descriptionShort : string|null
- The commands decsription displayed when listening commands if null it will fallback to the description property
- $expectedArguments : array<string, array<string, mixed>>
- An array of expected arguments
- $registry : CommandRegistry
- An instance of the command registry
- $verbose : bool
- Enable / Disable verbose
Methods
- __construct() : mixed
- Constructor
- execute() : void
- getCommandDescription() : string
- Returns the commands description
- getCommandShortDescription() : string
- Returns the short commands description
- getExpectedArguments() : array<string, array<string, mixed>>
- Returns the expected arguments and by default the class property
- info() : void
- Print a info string
- setCommandLineInterface() : void
- Sets the current command line interface
- setVerbose() : void
- Set the current verbose state
- success() : void
- Print a success string
- getCommandsMetaCachePath() : string
- Command cache file path
- hasCommandsMetaCache() : bool
- has commands cache file?
- loadCommandsMetaCache() : array<string, array<string, mixed>>
- Loads the commands cache
- writeCommandsMetaCache() : void
- Write commands meta cache
Properties
$cli
Instance of the command line interface
protected
CLImate
$cli
= null
$description
The commands decsription displayed when listening commands or in the help dialog
protected
string
$description
= ''
$descriptionShort
The commands decsription displayed when listening commands if null it will fallback to the description property
protected
string|null
$descriptionShort
= 'Lists all available commands in VISU.'
$expectedArguments
An array of expected arguments
protected
array<string, array<string, mixed>>
$expectedArguments
= ['find' => ['description' => 'Search for a command by the given name.', 'longPrefix' => 'find', 'prefix' => 'f', 'castTo' => 'string'], 'show_class' => ['description' => 'Displays the commands class.', 'longPrefix' => 'show-class', 'prefix' => 'c', 'noValue' => true]]
$registry
An instance of the command registry
protected
CommandRegistry
$registry
$verbose
Enable / Disable verbose
protected
bool
$verbose
= false
Methods
__construct()
Constructor
public
__construct(CommandRegistry $registry) : mixed
Parameters
- $registry : CommandRegistry
execute()
public
execute() : void
. Execute this command
getCommandDescription()
Returns the commands description
public
getCommandDescription() : string
Return values
stringgetCommandShortDescription()
Returns the short commands description
public
getCommandShortDescription() : string
Return values
stringgetExpectedArguments()
Returns the expected arguments and by default the class property
public
getExpectedArguments(array<string|int, mixed> $argumentVector) : array<string, array<string, mixed>>
Parameters
- $argumentVector : array<string|int, mixed>
-
The unparsed argument vector, allowing for subcommands to be handled.
Return values
array<string, array<string, mixed>>info()
Print a info string
public
info(string $message[, bool $onlyVerbose = false ][, string $key = 'info' ]) : void
Parameters
- $message : string
- $onlyVerbose : bool = false
- $key : string = 'info'
setCommandLineInterface()
Sets the current command line interface
public
final setCommandLineInterface(CLImate $cli) : void
Parameters
- $cli : CLImate
setVerbose()
Set the current verbose state
public
setVerbose(bool $value) : void
Parameters
- $value : bool
success()
Print a success string
public
success(string $message[, bool $onlyVerbose = false ][, string $key = 'success' ]) : void
Parameters
- $message : string
- $onlyVerbose : bool = false
- $key : string = 'success'
getCommandsMetaCachePath()
Command cache file path
private
getCommandsMetaCachePath() : string
Return values
stringhasCommandsMetaCache()
has commands cache file?
private
hasCommandsMetaCache() : bool
Return values
boolloadCommandsMetaCache()
Loads the commands cache
private
loadCommandsMetaCache() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>writeCommandsMetaCache()
Write commands meta cache
private
writeCommandsMetaCache(array<string, array<string, mixed>> $data) : void
Parameters
- $data : array<string, array<string, mixed>>