Class Symfony\Component\Console\Input\InputOption

InheritanceSymfony\Component\Console\Input\InputOption

Represents a command line option.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Symfony\Component\Console\Input\InputOption
acceptValue() Returns true if the option accepts a value. Symfony\Component\Console\Input\InputOption
equals() Checks whether the given option equals this one. Symfony\Component\Console\Input\InputOption
getDefault() Returns the default value. Symfony\Component\Console\Input\InputOption
getDescription() Returns the description text. Symfony\Component\Console\Input\InputOption
getName() Returns the option name. Symfony\Component\Console\Input\InputOption
getShortcut() Returns the option shortcut. Symfony\Component\Console\Input\InputOption
isArray() Returns true if the option can take multiple values. Symfony\Component\Console\Input\InputOption
isValueOptional() Returns true if the option takes an optional value. Symfony\Component\Console\Input\InputOption
isValueRequired() Returns true if the option requires a value. Symfony\Component\Console\Input\InputOption
setDefault() Sets the default value. Symfony\Component\Console\Input\InputOption

Method Details

__construct() public method

Constructor.

public void __construct ( $name, $shortcut null, $mode null, $description '', $default null )
$name string

The option name

$shortcut string|array

The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts

$mode int

The option mode: One of the VALUE_* constants

$description string

A description text

$default mixed

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

throws Symfony\Component\Console\Exception\InvalidArgumentException

If option mode is invalid or incompatible

acceptValue() public method

Returns true if the option accepts a value.

public bool acceptValue ( )
return bool

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

equals() public method

Checks whether the given option equals this one.

public bool equals ( Symfony\Component\Console\Input\InputOption $option )
$option Symfony\Component\Console\Input\InputOption

Option to compare

getDefault() public method

Returns the default value.

public mixed getDefault ( )
return mixed

The default value

getDescription() public method

Returns the description text.

public string getDescription ( )
return string

The description text

getName() public method

Returns the option name.

public string getName ( )
return string

The name

getShortcut() public method

Returns the option shortcut.

public string getShortcut ( )
return string

The shortcut

isArray() public method

Returns true if the option can take multiple values.

public bool isArray ( )
return bool

True if mode is self::VALUE_IS_ARRAY, false otherwise

isValueOptional() public method

Returns true if the option takes an optional value.

public bool isValueOptional ( )
return bool

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

isValueRequired() public method

Returns true if the option requires a value.

public bool isValueRequired ( )
return bool

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

setDefault() public method

Sets the default value.

public void setDefault ( $default null )
$default mixed

The default value

throws Symfony\Component\Console\Exception\LogicException

When incorrect default value is given