class Argument

Argument.

Constants

IS_INT

Integer flag.

IS_FLOAT

Float flag.

IS_BOOL

Boolean flag.

IS_ARRAY

Array flag.

IS_OPTIONAL

Optional flag.

NAME_REGEX

Regex that matches allowed parameter names.

ALIAS_REGEX

Regex that matches allowed aliases.

Properties

protected string $name Argument name.
protected string|null $alias Argument alias.
protected bool $isPositional Is the argument positional?
protected string $description Argument description.
protected int $options Argument options.
protected mixed $default Default value.

Methods

__construct(string $name, string $description = '', int $options = 0, mixed $default = null)

Constructor.

mixed
getDefaultValue()

Gets the default return value.

string
getValidatedName(string $name)

Returns a validated argument name.

string
getValidatedAlias(string $alias)

Returns a validated alias.

array
parseName(string $name)

Parse the argument name.

int
getValidatedOptions(int $options)

Returns validated options.

string
getName()

Returns the argument name.

string
getNormalizedName()

Returns the normalized argument name.

string|null
getAlias()

Returns the argument alias.

string
getDescription()

Returns the argument description.

bool
isPositional()

Is the argument positional?

bool
isInt()

Is the argument an integer?

bool
isFloat()

Is the argument a float?

bool
isBool()

Is the argument a boolean?

bool
isArray()

Is the argument an array?

bool
isOptional()

Is the argument optional?

Details

at line 125
__construct(string $name, string $description = '', int $options = 0, mixed $default = null)

Constructor.

Parameters

string $name Argument name
string $description Argument description
int $options Argument options
mixed $default Default return value (only used by optional arguments)

at line 152
mixed getDefaultValue()

Gets the default return value.

Return Value

mixed

at line 163
protected string getValidatedName(string $name)

Returns a validated argument name.

Parameters

string $name Argument name

Return Value

string

at line 179
protected string getValidatedAlias(string $alias)

Returns a validated alias.

Parameters

string $alias Alias

Return Value

string

at line 195
protected array parseName(string $name)

Parse the argument name.

Parameters

string $name Argument name

Return Value

array

at line 218
protected int getValidatedOptions(int $options)

Returns validated options.

Parameters

int $options Argument options

Return Value

int

at line 253
string getName()

Returns the argument name.

Return Value

string

at line 263
string getNormalizedName()

Returns the normalized argument name.

Return Value

string

at line 273
string|null getAlias()

Returns the argument alias.

Return Value

string|null

at line 283
string getDescription()

Returns the argument description.

Return Value

string

at line 293
bool isPositional()

Is the argument positional?

Return Value

bool

at line 303
bool isInt()

Is the argument an integer?

Return Value

bool

at line 313
bool isFloat()

Is the argument a float?

Return Value

bool

at line 323
bool isBool()

Is the argument a boolean?

Return Value

bool

at line 333
bool isArray()

Is the argument an array?

Return Value

bool

at line 343
bool isOptional()

Is the argument optional?

Return Value

bool