\Symfony\Component\Console\InputInputArgument

Represents a command line argument.

Summary

Methods
Properties
Constants
__construct()
getName()
isRequired()
isArray()
setDefault()
getDefault()
getDescription()
No public properties found
REQUIRED
OPTIONAL
IS_ARRAY
No protected methods found
No protected properties found
N/A
No private methods found
$name
$mode
$default
$description
N/A

Constants

REQUIRED

REQUIRED = 1

OPTIONAL

OPTIONAL = 2

IS_ARRAY

IS_ARRAY = 4

Properties

$name

$name : 

Type

$mode

$mode : 

Type

$default

$default : 

Type

$description

$description : 

Type

Methods

__construct()

__construct(string  $name, integer|null  $mode = null, string  $description = '', string|array<mixed,string>|null  $default = null) 

Parameters

string $name

The argument name

integer|null $mode

The argument mode: self::REQUIRED or self::OPTIONAL

string $description

A description text

string|array<mixed,string>|null $default

The default value (for self::OPTIONAL mode only)

Throws

\Symfony\Component\Console\Exception\InvalidArgumentException

When argument mode is not valid

getName()

getName() : string

Returns the argument name.

Returns

string —

The argument name

isRequired()

isRequired() : boolean

Returns true if the argument is required.

Returns

boolean —

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

isArray()

isArray() : boolean

Returns true if the argument can take multiple values.

Returns

boolean —

true if mode is self::IS_ARRAY, false otherwise

setDefault()

setDefault(string|array<mixed,string>|null  $default = null) 

Sets the default value.

Parameters

string|array<mixed,string>|null $default

The default value

Throws

\Symfony\Component\Console\Exception\LogicException

When incorrect default value is given

getDefault()

getDefault() : string|array<mixed,string>|null

Returns the default value.

Returns

string|array<mixed,string>|null —

The default value

getDescription()

getDescription() : string

Returns the description text.

Returns

string —

The description text