\Vegas\Cli\TaskOption

Class Option

Summary

Methods
Properties
Constants
__construct()
getName()
getShortName()
getDescription()
setValidator()
matchParam()
setRequired()
isRequired()
validate()
getValue()
No public properties found
No constants found
No protected methods found
$name
$shortName
$validator
$description
$isRequired
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name : string

Long name of option with `--` as prefix

Type

string

$shortName

$shortName : string

Short name of option with `-` as prefix

Type

string

$validator

$validator : callable

Validation function

Type

callable

$description

$description : string

Description of option

Type

string

$isRequired

$isRequired : boolean

Determines if option is required

Type

boolean

Methods

__construct()

__construct( $name,  $shortName, string $description)

Constructor

Parameters

$name
$shortName
string $description

getName()

getName() : string

Returns full name of option

Returns

string

getShortName()

getShortName() : string

Returns short name of option

Returns

string

getDescription()

getDescription() : string

Return description of option

Returns

string

setValidator()

setValidator(callable $validator)

Sets validator function

Parameters

callable $validator

matchParam()

matchParam( $paramName) : boolean

Checks if parameter name matches to long or short name of option

Parameters

$paramName

Returns

boolean

setRequired()

setRequired(boolean $required) : $this

Determines if option is required

Parameters

boolean $required

Returns

$this

isRequired()

isRequired() : boolean

Determines if option is required

Returns

boolean

validate()

validate( $value) : boolean|mixed

Validates option value

Parameters

$value

Returns

boolean|mixed

getValue()

getValue( $args, null $default) : mixed

Looks for value of option in specified arguments array.

When option is not found then returns default value.

Parameters

$args
null $default

Returns

mixed