InputArgument
in package
Represents a command line argument.
Tags
Table of Contents
- IS_ARRAY = 4
- OPTIONAL = 2
- REQUIRED = 1
- $default : mixed
- $description : mixed
- $mode : mixed
- $name : mixed
- __construct() : mixed
- getDefault() : string|bool|int|float|array<string|int, mixed>|null
- Returns the default value.
- getDescription() : string
- Returns the description text.
- getName() : string
- Returns the argument name.
- isArray() : bool
- Returns true if the argument can take multiple values.
- isRequired() : bool
- Returns true if the argument is required.
- setDefault() : mixed
- Sets the default value.
Constants
IS_ARRAY
public
mixed
IS_ARRAY
= 4
OPTIONAL
public
mixed
OPTIONAL
= 2
REQUIRED
public
mixed
REQUIRED
= 1
Properties
$default
private
mixed
$default
$description
private
mixed
$description
$mode
private
mixed
$mode
$name
private
mixed
$name
Methods
__construct()
public
__construct(string $name[, int|null $mode = null ][, string $description = '' ][, string|bool|int|float|array<string|int, mixed>|null $default = null ]) : mixed
Parameters
- $name : string
-
The argument name
- $mode : int|null = null
-
The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY
- $description : string = ''
-
A description text
- $default : string|bool|int|float|array<string|int, mixed>|null = null
-
The default value (for self::OPTIONAL mode only)
Tags
Return values
mixed —getDefault()
Returns the default value.
public
getDefault() : string|bool|int|float|array<string|int, mixed>|null
Return values
string|bool|int|float|array<string|int, mixed>|null —getDescription()
Returns the description text.
public
getDescription() : string
Return values
string —getName()
Returns the argument name.
public
getName() : string
Return values
string —isArray()
Returns true if the argument can take multiple values.
public
isArray() : bool
Return values
bool —true if mode is self::IS_ARRAY, false otherwise
isRequired()
Returns true if the argument is required.
public
isRequired() : bool
Return values
bool —true if parameter mode is self::REQUIRED, false otherwise
setDefault()
Sets the default value.
public
setDefault([string|bool|int|float|array<string|int, mixed>|null $default = null ]) : mixed
Parameters
- $default : string|bool|int|float|array<string|int, mixed>|null = null