PHP Class Airship\Hangar\Command

Show file Open project: paragonie/airship Class Usage Examples

Public Properties

Property Type Description
$cache array Cache references to other commands
$description string
$display integer
$essential boolean
$name string
$session array hangar.session.json
$tag array
$userConfig Current user's configuration

Protected Properties

Property Type Description
$c array BASH COLORS
$config array hangar.json

Public Methods

Method Description
fire ( array $args = [] ) : boolean Execute a command
getCommandObject ( string $name, boolean $cache = true ) : self Return a command
getCommandStatic ( string $name, boolean $cache = true ) : Command Return a command (statically callable)
getScreenSize ( ) : array Return the size of the current terminal window
getToken ( string $supplier ) : string Get a token for HTTP requests
saveConfig ( ) Save the configuration
storeConfig ( array $data = [] )
usageInfo ( array $args = [] ) : boolean Display the usage information for this command.

Protected Methods

Method Description
getSession ( ) : mixed Get the session data
prompt ( string $text ) : string Prompt the user for an input value
silentPrompt ( string $text = "Enter Password:" ) : string Interactively prompts for input without echoing to the terminal.

Method Details

fire() abstract public method

Execute a command
abstract public fire ( array $args = [] ) : boolean
$args array
return boolean

getCommandObject() public method

Return a command
public getCommandObject ( string $name, boolean $cache = true ) : self
$name string
$cache boolean
return self (derived class)

getCommandStatic() public static method

Return a command (statically callable)
public static getCommandStatic ( string $name, boolean $cache = true ) : Command
$name string
$cache boolean
return Command

getScreenSize() public method

Return the size of the current terminal window
public getScreenSize ( ) : array
return array (int, int)

getSession() final protected method

Get the session data
final protected getSession ( ) : mixed
return mixed

getToken() public method

Get a token for HTTP requests
public getToken ( string $supplier ) : string
$supplier string
return string

prompt() final protected method

Prompt the user for an input value
final protected prompt ( string $text ) : string
$text string
return string

saveConfig() final public method

Save the configuration
final public saveConfig ( )

silentPrompt() final protected method

Requires a bash shell or Windows and won't work with safe_mode settings (Uses shell_exec)
final protected silentPrompt ( string $text = "Enter Password:" ) : string
$text string
return string

storeConfig() final public method

final public storeConfig ( array $data = [] )
$data array

usageInfo() public method

Display the usage information for this command.
public usageInfo ( array $args = [] ) : boolean
$args array - CLI arguments
return boolean

Property Details

$c protected property

BASH COLORS
protected array $c
return array

$cache public static property

Cache references to other commands
public static array $cache
return array

$config protected property

hangar.json
protected array $config
return array

$description public property

public string $description
return string

$display public property

public int $display
return integer

$essential public property

public bool $essential
return boolean

$name public property

public string $name
return string

$session public property

hangar.session.json
public array $session
return array

$tag public property

public array $tag
return array

$userConfig public static property

Current user's configuration
public static $userConfig