Represents a command line option.
Method Summary
-
Boolean
isParameterRequired()
Returns true if the option requires a parameter.
-
__construct($name, $shortcut = null, $mode = null, $help = '', $default = null)
Constructor.
-
setDefault($default = null)
Sets the default value.
-
Boolean
isArray()
Returns true if the option can take multiple values.
-
string
getShortcut()
Returns the shortcut.
-
string
getName()
Returns the name.
-
mixed
getDefault()
Returns the default value.
-
string
getHelp()
Returns the help text.
-
Boolean
acceptParameter()
Returns true if the option accept a parameter.
-
Boolean
isParameterOptional()
Returns true if the option takes an optional parameter.
Method Details
-
(Boolean) isParameterRequired ()
Returns true if the option requires a parameter.
returns true if parameter mode is self::PARAMETER_REQUIRED, false otherwise
-
__construct ($name, $shortcut = null, $mode = null, $help = '', $default = null)
| $name |
The option name |
| $shortcut |
The shortcut (can be null) |
| $mode |
The option mode: self::PARAMETER_REQUIRED, self::PARAMETER_NONE or
self::PARAMETER_OPTIONAL |
| $help |
A help text |
| $default |
The default value (must be null for self::PARAMETER_REQUIRED or
self::PARAMETER_NONE) |
Constructor.
-
setDefault ($default = null)
| $default |
The default value |
Sets the default value.
-
(Boolean) isArray ()
Returns true if the option can take multiple values.
returns true if mode is self::IS_ARRAY, false otherwise
-
(string) getShortcut ()
Returns the shortcut.
returns The shortcut
-
(string) getName ()
Returns the name.
returns The name
-
(mixed) getDefault ()
Returns the default value.
returns The default value
-
(string) getHelp ()
Returns the help text.
returns The help text
-
(Boolean) acceptParameter ()
Returns true if the option accept a parameter.
returns true if parameter mode is not self::PARAMETER_NONE, false otherwise
-
(Boolean) isParameterOptional ()
Returns true if the option takes an optional parameter.
returns true if parameter mode is self::PARAMETER_OPTIONAL, false otherwise
|