Overview

Namespaces

  • Evenement
  • None
  • Peridot
    • Console
    • Core
    • Reporter
    • Runner
    • Scope
    • Test
  • Symfony
    • Component
      • Console
        • Command
        • Descriptor
        • Event
        • Exception
        • Formatter
        • Helper
        • Input
        • Logger
        • Output
        • Question
        • Style
        • Tester
        • Tests
          • Command
          • Descriptor
          • Fixtures
          • Formatter
          • Helper
          • Input
          • Logger
          • Output
          • Style
          • Tester

Classes

  • ArgvInput
  • ArrayInput
  • Input
  • InputArgument
  • InputDefinition
  • InputOption
  • StringInput

Interfaces

  • InputAwareInterface
  • InputInterface
  • Overview
  • Namespace
  • Class

Class InputOption

Represents a command line option.

Namespace: Symfony\Component\Console\Input
Author: Fabien Potencier fabien@symfony.com
Located at Input/InputOption.php
Methods summary
public
# __construct( string $name, string|array $shortcut = null, integer $mode = null, string $description = '', mixed $default = null )

Constructor.

Constructor.

Parameters

$name
The option name
$shortcut
The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
$mode
The option mode: One of the VALUE_* constants
$description
A description text
$default
The default value (must be null for self::VALUE_NONE)

Throws

Symfony\Component\Console\Exception\InvalidArgumentException
If option mode is invalid or incompatible
public string
# getShortcut( )

Returns the option shortcut.

Returns the option shortcut.

Returns

string
The shortcut
public string
# getName( )

Returns the option name.

Returns the option name.

Returns

string
The name
public boolean
# acceptValue( )

Returns true if the option accepts a value.

Returns true if the option accepts a value.

Returns

boolean
true if value mode is not self::VALUE_NONE, false otherwise
public boolean
# isValueRequired( )

Returns true if the option requires a value.

Returns true if the option requires a value.

Returns

boolean
true if value mode is self::VALUE_REQUIRED, false otherwise
public boolean
# isValueOptional( )

Returns true if the option takes an optional value.

Returns true if the option takes an optional value.

Returns

boolean
true if value mode is self::VALUE_OPTIONAL, false otherwise
public boolean
# isArray( )

Returns true if the option can take multiple values.

Returns true if the option can take multiple values.

Returns

boolean
true if mode is self::VALUE_IS_ARRAY, false otherwise
public
# setDefault( mixed $default = null )

Sets the default value.

Sets the default value.

Parameters

$default
The default value

Throws

Symfony\Component\Console\Exception\LogicException
When incorrect default value is given
public mixed
# getDefault( )

Returns the default value.

Returns the default value.

Returns

mixed
The default value
public string
# getDescription( )

Returns the description text.

Returns the description text.

Returns

string
The description text
public boolean
# equals( Symfony\Component\Console\Input\InputOption $option )

Checks whether the given option equals this one.

Checks whether the given option equals this one.

Parameters

$option
option to compare

Returns

boolean
Constants summary
integer VALUE_NONE
# 1
integer VALUE_REQUIRED
# 2
integer VALUE_OPTIONAL
# 4
integer VALUE_IS_ARRAY
# 8
Peridot API documentation generated by ApiGen