InputOption
    
            
            in package
            
        
    
    
    
Represents a command line option.
Tags
Table of Contents
Constants
- VALUE_IS_ARRAY = 8
 - The option accepts multiple values (e.g. --dir=/foo --dir=/bar).
 - VALUE_NEGATABLE = 16
 - The option allows passing a negated variant (e.g. --ansi or --no-ansi).
 - VALUE_NONE = 1
 - Do not accept input for the option (e.g. --yell). This is the default behavior of options.
 - VALUE_OPTIONAL = 4
 - The option may or may not have a value (e.g. --yell or --yell=loud).
 - VALUE_REQUIRED = 2
 - A value must be passed when the option is used (e.g. --iterations=5 or -i5).
 
Methods
- __construct() : mixed
 - acceptValue() : bool
 - Returns true if the option accepts a value.
 - complete() : void
 - Supplies suggestions when command resolves possible completion options for input.
 - equals() : bool
 - Checks whether the given option equals this one.
 - getDefault() : string|bool|int|float|array<string|int, mixed>|null
 - Returns the default value.
 - getDescription() : string
 - Returns the description text.
 - getName() : string
 - Returns the option name.
 - getShortcut() : string|null
 - Returns the option shortcut.
 - hasCompletion() : bool
 - Returns true if the option has values for input completion.
 - isArray() : bool
 - Returns true if the option can take multiple values.
 - isNegatable() : bool
 - Returns true if the option allows passing a negated variant.
 - isValueOptional() : bool
 - Returns true if the option takes an optional value.
 - isValueRequired() : bool
 - Returns true if the option requires a value.
 - setDefault() : void
 - Sets the default value.
 
Constants
VALUE_IS_ARRAY
The option accepts multiple values (e.g. --dir=/foo --dir=/bar).
    public
        mixed
    VALUE_IS_ARRAY
    = 8
    
    
    
    
VALUE_NEGATABLE
The option allows passing a negated variant (e.g. --ansi or --no-ansi).
    public
        mixed
    VALUE_NEGATABLE
    = 16
    
    
    
    
VALUE_NONE
Do not accept input for the option (e.g. --yell). This is the default behavior of options.
    public
        mixed
    VALUE_NONE
    = 1
    
    
    
    
VALUE_OPTIONAL
The option may or may not have a value (e.g. --yell or --yell=loud).
    public
        mixed
    VALUE_OPTIONAL
    = 4
    
    
    
    
VALUE_REQUIRED
A value must be passed when the option is used (e.g. --iterations=5 or -i5).
    public
        mixed
    VALUE_REQUIRED
    = 2
    
    
    
    
Methods
__construct()
    public
                    __construct(string $name[, string|array<string|int, mixed>|null $shortcut = null ][, int|null $mode = null ][, string $description = '' ][, string|bool|int|float|array<string|int, mixed>|null $default = null ][, array<string|int, mixed>|callable(CompletionInput, CompletionSuggestions): array<int, string|Suggestion> $suggestedValues = [] ]) : mixed
    Parameters
- $name : string
 - $shortcut : string|array<string|int, mixed>|null = null
 - 
                    
The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
 - $mode : int|null = null
 - $description : string = ''
 - $default : string|bool|int|float|array<string|int, mixed>|null = null
 - 
                    
The default value (must be null for self::VALUE_NONE)
 - $suggestedValues : array<string|int, mixed>|callable(CompletionInput, CompletionSuggestions): array<int, string|Suggestion> = []
 - 
                    
The values used for input completion
 
Tags
acceptValue()
Returns true if the option accepts a value.
    public
                    acceptValue() : bool
    Return values
bool —true if value mode is not self::VALUE_NONE, false otherwise
complete()
Supplies suggestions when command resolves possible completion options for input.
    public
                    complete(CompletionInput $input, CompletionSuggestions $suggestions) : void
    Parameters
- $input : CompletionInput
 - $suggestions : CompletionSuggestions
 
Tags
equals()
Checks whether the given option equals this one.
    public
                    equals(self $option) : bool
    Parameters
- $option : self
 
Return values
boolgetDefault()
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>|nullgetDescription()
Returns the description text.
    public
                    getDescription() : string
    Return values
stringgetName()
Returns the option name.
    public
                    getName() : string
    Return values
stringgetShortcut()
Returns the option shortcut.
    public
                    getShortcut() : string|null
    Return values
string|nullhasCompletion()
Returns true if the option has values for input completion.
    public
                    hasCompletion() : bool
    Return values
boolisArray()
Returns true if the option can take multiple values.
    public
                    isArray() : bool
    Return values
bool —true if mode is self::VALUE_IS_ARRAY, false otherwise
isNegatable()
Returns true if the option allows passing a negated variant.
    public
                    isNegatable() : bool
    Return values
bool —true if mode is self::VALUE_NEGATABLE, false otherwise
isValueOptional()
Returns true if the option takes an optional value.
    public
                    isValueOptional() : bool
    Return values
bool —true if value mode is self::VALUE_OPTIONAL, false otherwise
isValueRequired()
Returns true if the option requires a value.
    public
                    isValueRequired() : bool
    Return values
bool —true if value mode is self::VALUE_REQUIRED, false otherwise
setDefault()
Sets the default value.
    public
                    setDefault(string|bool|int|float|array<string|int, mixed>|null $default) : void
    Parameters
- $default : string|bool|int|float|array<string|int, mixed>|null