PHP Class Commando\Option

This is merely for intellisense purposes!
Afficher le fichier Open project: nategood/commando Class Usage Examples

Méthodes publiques

Méthode 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 méthode

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

__toString() public méthode

public __toString ( ) : string
Résultat string

addAlias() public méthode

public addAlias ( string $alias ) : Option
$alias string
Résultat Option

getAliases() public méthode

public getAliases ( ) : string[]
Résultat string[] list of aliases

getDefault() public méthode

public getDefault ( ) : mixed
Résultat mixed

getDescription() public méthode

public getDescription ( ) : string
Résultat string description of the option

getHelp() public méthode

public getHelp ( ) : string
Résultat string

getName() public méthode

public getName ( ) : string | integer
Résultat string | integer name of the option

getNeeds() public méthode

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

getType() public méthode

public getType ( ) : integer
Résultat integer type (see OPTION_TYPE_CONST)

getValue() public méthode

public getValue ( ) : mixed
Résultat mixed value of the option

hasNeeds() public méthode

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

isBoolean() public méthode

public isBoolean ( ) : boolean
Résultat boolean is this option a boolean

isFile() public méthode

public isFile ( ) : boolean
Résultat boolean is this option a boolean

isIncrement() public méthode

public isIncrement ( ) : boolean
Résultat boolean is this option an incremental option

isRequired() public méthode

public isRequired ( ) : boolean
Résultat boolean is this option required?

map() public méthode

public map ( Closure | string $value ) : Option
$value Closure | string regex, closure
Résultat Option

parseFilePath() public méthode

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

setBoolean() public méthode

public setBoolean ( boolean $bool = true ) : Option
$bool boolean
Résultat Option

setDefault() public méthode

public setDefault ( mixed $value ) : Option
$value mixed default value
Résultat Option

setDescription() public méthode

public setDescription ( string $description ) : Option
$description string
Résultat Option

setFileRequirements() public méthode

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
Résultat void

setIncrement() public méthode

public setIncrement ( integer $max ) : Option
$max integer
Résultat Option

setMap() public méthode

public setMap ( Closure $map ) : Option
$map Closure
Résultat Option

setNeeds() public méthode

Set an option as required
public setNeeds ( string $option ) : Option
$option string Option name
Résultat Option

setRequired() public méthode

public setRequired ( boolean $bool = true ) : Option
$bool boolean required?
Résultat Option

setRule() public méthode

public setRule ( Closure | string $rule ) : Option
$rule Closure | string regex, closure
Résultat Option

setTitle() public méthode

public setTitle ( string $title ) : Option
$title string
Résultat Option

setValue() public méthode

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

validate() public méthode

public validate ( mixed $value ) : boolean
$value mixed
Résultat boolean