PHP Class Phrozn\Runner\CommandLine\Callback\Base

Author: Victor Farazdagi
Inheritance: implements Phrozn\Runner\CommandLine\Callback
Afficher le fichier Open project: farazdagi/phrozn

Méthodes publiques

Méthode Description
getConfig ( ) : array Get command config array
getOutputter ( ) : Console_CommandLine_Outputter Get CLI outputter
getParseResult ( ) : Console_CommandLine_Result Get parsed result object
out ( string $str ) : Phrozn\Runner\CommandLine\Callback Output string to stdout (flushes output). Wrapper around Outputter
readLine ( ) : string Read-line either from STDIN or mock unit test data
setConfig ( array $config ) : Phrozn\Runner\CommandLine\Callback Set config data for a given callback
setOutputter ( $out ) : Phrozn\Runner\CommandLine\Callback Set CLI outputter
setParseResult ( Console_CommandLine_Result $result ) : Phrozn\Runner\CommandLine\Callback Result object of CLI input parsing
setUnitTestData ( $data ) : Phrozn\Runner\CommandLine\Callback Since Unit Testing readline can be tricky, confirm answer is exposed to unit test via this method. Simply pass the string you want to be used in place of readline() result.

Méthodes protégées

Méthode Description
combine ( string $file, boolean $verbose = false ) : string Combine command documentation
getFooter ( ) : string Phrozn CLI footer
getHeader ( ) : string Phrozn CLI header
getPathArgument ( string $name, boolean $realpath = true, Console_CommandLine_Result $command = null ) : string Extract path argument or fallback to cwd
isAbsolute ( string $path ) : boolean See whether given path is absolute or relative
pad ( $str )
pre ( array $arr ) : string Prepend all lines in array with intendation

Private Methods

Méthode Description
getCommandMeta ( )
getRealCommandName ( string $file ) : string Search if an alias exists for this command
useAnsiColors ( )

Method Details

combine() protected méthode

Combine command documentation
protected combine ( string $file, boolean $verbose = false ) : string
$file string Command file to combine
$verbose boolean Whether to provide full documentation or just summary
Résultat string

getConfig() public méthode

Get command config array
public getConfig ( ) : array
Résultat array

getFooter() protected méthode

Phrozn CLI footer
protected getFooter ( ) : string
Résultat string

getHeader() protected méthode

Phrozn CLI header
protected getHeader ( ) : string
Résultat string

getOutputter() public méthode

Get CLI outputter
public getOutputter ( ) : Console_CommandLine_Outputter
Résultat Console_CommandLine_Outputter CLI outputter instance

getParseResult() public méthode

Get parsed result object
public getParseResult ( ) : Console_CommandLine_Result
Résultat Console_CommandLine_Result

getPathArgument() protected méthode

Extract path argument or fallback to cwd
protected getPathArgument ( string $name, boolean $realpath = true, Console_CommandLine_Result $command = null ) : string
$name string Name of the path argument
$realpath boolean Whether to apply realpath() to path
$command Console_CommandLine_Result Command line result to use
Résultat string

isAbsolute() protected méthode

See whether given path is absolute or relative
protected isAbsolute ( string $path ) : boolean
$path string Path to check
Résultat boolean

out() public méthode

Output string to stdout (flushes output). Wrapper around Outputter
public out ( string $str ) : Phrozn\Runner\CommandLine\Callback
$str string String to output
Résultat Phrozn\Runner\CommandLine\Callback

pad() protected méthode

protected pad ( $str )

pre() protected méthode

Prepend all lines in array with intendation
protected pre ( array $arr ) : string
$arr array Array to combine
Résultat string

readLine() public méthode

Read-line either from STDIN or mock unit test data
public readLine ( ) : string
Résultat string

setConfig() public méthode

Set config data for a given callback
public setConfig ( array $config ) : Phrozn\Runner\CommandLine\Callback
$config array Config array
Résultat Phrozn\Runner\CommandLine\Callback

setOutputter() public méthode

Set CLI outputter
public setOutputter ( $out ) : Phrozn\Runner\CommandLine\Callback
Résultat Phrozn\Runner\CommandLine\Callback

setParseResult() public méthode

Result object of CLI input parsing
public setParseResult ( Console_CommandLine_Result $result ) : Phrozn\Runner\CommandLine\Callback
$result Console_CommandLine_Result Parser's result
Résultat Phrozn\Runner\CommandLine\Callback

setUnitTestData() public méthode

Since Unit Testing readline can be tricky, confirm answer is exposed to unit test via this method. Simply pass the string you want to be used in place of readline() result.
public setUnitTestData ( $data ) : Phrozn\Runner\CommandLine\Callback
Résultat Phrozn\Runner\CommandLine\Callback