PHP Class Commando\Option

This is merely for intellisense purposes!
Show file Open project: nategood/commando Class Usage Examples

Public Methods

Method Description
__construct ( string | integer $name ) : Option
__toString ( ) : string
addAlias ( string $alias ) : Option
getAliases ( ) : string[]
getDefault ( ) : mixed
getDescription ( ) : string
getHelp ( ) : string
getName ( ) : string | integer
getNeeds ( ) : string[] Get the current set of this option's requirements
getType ( ) : integer
getValue ( ) : mixed
hasNeeds ( array $optionsList ) : boolean | array Check to see if requirements list for option are met
isBoolean ( ) : boolean
isFile ( ) : boolean
isIncrement ( ) : boolean
isRequired ( ) : boolean
map ( Closure | string $value ) : Option
parseFilePath ( string $file_path ) : string | array
setBoolean ( boolean $bool = true ) : Option
setDefault ( mixed $value ) : Option
setDescription ( string $description ) : Option
setFileRequirements ( boolean $require_exists = true, boolean $allow_globbing = true ) : void Require that the argument is a file. This will make sure the argument is a valid file, will expand the file path provided to a full path (e.g. map relative paths), and in the case where $allow_globbing is set, supports file globbing and returns an array of matching files.
setIncrement ( integer $max ) : Option
setMap ( Closure $map ) : Option
setNeeds ( string $option ) : Option Set an option as required
setRequired ( boolean $bool = true ) : Option
setRule ( Closure | string $rule ) : Option
setTitle ( string $title ) : Option
setValue ( mixed $value )
validate ( mixed $value ) : boolean

Method Details

__construct() public method

public __construct ( string | integer $name ) : Option
$name string | integer single char name or int index for this option
return Option

__toString() public method

public __toString ( ) : string
return string

addAlias() public method

public addAlias ( string $alias ) : Option
$alias string
return Option

getAliases() public method

public getAliases ( ) : string[]
return string[] list of aliases

getDefault() public method

public getDefault ( ) : mixed
return mixed

getDescription() public method

public getDescription ( ) : string
return string description of the option

getHelp() public method

public getHelp ( ) : string
return string

getName() public method

public getName ( ) : string | integer
return string | integer name of the option

getNeeds() public method

Get the current set of this option's requirements
public getNeeds ( ) : string[]
return string[] List of required options

getType() public method

public getType ( ) : integer
return integer type (see OPTION_TYPE_CONST)

getValue() public method

public getValue ( ) : mixed
return mixed value of the option

hasNeeds() public method

Check to see if requirements list for option are met
public hasNeeds ( array $optionsList ) : boolean | array
$optionsList array Set of current options defined
return boolean | array True if requirements met, array if not found

isBoolean() public method

public isBoolean ( ) : boolean
return boolean is this option a boolean

isFile() public method

public isFile ( ) : boolean
return boolean is this option a boolean

isIncrement() public method

public isIncrement ( ) : boolean
return boolean is this option an incremental option

isRequired() public method

public isRequired ( ) : boolean
return boolean is this option required?

map() public method

public map ( Closure | string $value ) : Option
$value Closure | string regex, closure
return Option

parseFilePath() public method

public parseFilePath ( string $file_path ) : string | array
$file_path string
return string | array full file path or an array of file paths in the case where "globbing" is supported

setBoolean() public method

public setBoolean ( boolean $bool = true ) : Option
$bool boolean
return Option

setDefault() public method

public setDefault ( mixed $value ) : Option
$value mixed default value
return Option

setDescription() public method

public setDescription ( string $description ) : Option
$description string
return Option

setFileRequirements() public method

Require that the argument is a file. This will make sure the argument is a valid file, will expand the file path provided to a full path (e.g. map relative paths), and in the case where $allow_globbing is set, supports file globbing and returns an array of matching files.
public setFileRequirements ( boolean $require_exists = true, boolean $allow_globbing = true ) : void
$require_exists boolean
$allow_globbing boolean
return void

setIncrement() public method

public setIncrement ( integer $max ) : Option
$max integer
return Option

setMap() public method

public setMap ( Closure $map ) : Option
$map Closure
return Option

setNeeds() public method

Set an option as required
public setNeeds ( string $option ) : Option
$option string Option name
return Option

setRequired() public method

public setRequired ( boolean $bool = true ) : Option
$bool boolean required?
return Option

setRule() public method

public setRule ( Closure | string $rule ) : Option
$rule Closure | string regex, closure
return Option

setTitle() public method

public setTitle ( string $title ) : Option
$title string
return Option

setValue() public method

public setValue ( mixed $value )
$value mixed for this option (set on the command line)

validate() public method

public validate ( mixed $value ) : boolean
$value mixed
return boolean