class InputArgument

Represents a command line argument.

Constants

REQUIRED

OPTIONAL

IS_ARRAY

Methods

__construct(string $name, int $mode = null, string $description = '', string|string[]|null $default = null)

No description

string
getName()

Returns the argument name.

bool
isRequired()

Returns true if the argument is required.

bool
isArray()

Returns true if the argument can take multiple values.

setDefault(string|string[]|null $default = null)

Sets the default value.

string|string[]|null
getDefault()

Returns the default value.

string
getDescription()

Returns the description text.

Details

at line 41
__construct(string $name, int $mode = null, string $description = '', string|string[]|null $default = null)

Parameters

string $name The argument name
int $mode The argument mode: self::REQUIRED or self::OPTIONAL
string $description A description text
string|string[]|null $default The default value (for self::OPTIONAL mode only)

Exceptions

InvalidArgumentException When argument mode is not valid

at line 61
string getName()

Returns the argument name.

Return Value

string The argument name

at line 71
bool isRequired()

Returns true if the argument is required.

Return Value

bool true if parameter mode is self::REQUIRED, false otherwise

at line 81
bool isArray()

Returns true if the argument can take multiple values.

Return Value

bool true if mode is self::IS_ARRAY, false otherwise

at line 93
setDefault(string|string[]|null $default = null)

Sets the default value.

Parameters

string|string[]|null $default The default value

Exceptions

LogicException When incorrect default value is given

at line 115
string|string[]|null getDefault()

Returns the default value.

Return Value

string|string[]|null The default value

at line 125
string getDescription()

Returns the description text.

Return Value

string The description text