SymfonyComponentConsoleInputInputOption

Represents a command line option.

File
vendorSymfonyComponentConsoleInputInputOption.php
Package
Default
Class hierarchy
SymfonyComponentConsoleInputInputOption

Tags

author

Fabien Potencier fabien@symfony.com

api

Constants

VALUE_NONE

VALUE_NONE

Tags

None found

VALUE_REQUIRED

VALUE_REQUIRED

Tags

None found

VALUE_OPTIONAL

VALUE_OPTIONAL

Tags

None found

VALUE_IS_ARRAY

VALUE_IS_ARRAY

Tags

None found

Properties

$name

$name : 

Type

Tags

None found

$shortcut

$shortcut : 

Type

Tags

None found

$mode

$mode : 

Type

Tags

None found

$default

$default : 

Type

Tags

None found

$description

$description : 

Type

Tags

None found

Methods

__construct()

__construct(string  $name, string  $shortcut = null, integer  $mode = null, string  $description = '', mixed  $default = null) 

Constructor.

Parameters

string $name

The option name

string $shortcut

The shortcut (can be null)

integer $mode

The option mode: One of the VALUE_* constants

string $description

A description text

mixed $default

The default value (must be null for self::VALUE_REQUIRED or self::VALUE_NONE)

Throws

InvalidArgumentException

If option mode is invalid or incompatible

Tags

api

getShortcut()

getShortcut() : string

Returns the option shortcut.

Returns

string —

The shortcut

Tags

None found

getName()

getName() : string

Returns the option name.

Returns

string —

The name

Tags

None found

acceptValue()

acceptValue() : Boolean

Returns true if the option accepts a value.

Returns

Boolean —

true if value mode is not self::VALUE_NONE, false otherwise

Tags

None found

isValueRequired()

isValueRequired() : Boolean

Returns true if the option requires a value.

Returns

Boolean —

true if value mode is self::VALUE_REQUIRED, false otherwise

Tags

None found

isValueOptional()

isValueOptional() : Boolean

Returns true if the option takes an optional value.

Returns

Boolean —

true if value mode is self::VALUE_OPTIONAL, false otherwise

Tags

None found

isArray()

isArray() : Boolean

Returns true if the option can take multiple values.

Returns

Boolean —

true if mode is self::VALUE_IS_ARRAY, false otherwise

Tags

None found

setDefault()

setDefault(mixed  $default = null) 

Sets the default value.

Parameters

mixed $default

The default value

Throws

LogicException

When incorrect default value is given

Tags

None found

getDefault()

getDefault() : mixed

Returns the default value.

Returns

mixed —

The default value

Tags

None found

getDescription()

getDescription() : string

Returns the description text.

Returns

string —

The description text

Tags

None found

equals()

equals(\Symfony\Component\Console\Input\InputOption  $option) : Boolean

Checks whether the given option equals this one

Parameters

SymfonyComponentConsoleInputInputOption $option

option to compare

Returns

Boolean

Tags

None found