PHP Class Webmozart\Console\Api\Args\Format\AbstractOption

Since: 1.0
Author: Bernhard Schussek ([email protected])
Show file Open project: webmozart/console Class Usage Examples

Protected Properties

Property Type Description
$flags integer

Public Methods

Method Description
__construct ( string $longName, string | null $shortName = null, integer $flags, string $description = null ) Creates a new option.
getDescription ( ) : string Returns the description text.
getLongName ( ) : string Returns the long option name.
getShortName ( ) : string Returns the short option name.
isLongNamePreferred ( ) : boolean Returns whether using the long name is preferred over using the short name.
isShortNamePreferred ( ) : boolean Returns whether using the short name is preferred over using the long name.

Private Methods

Method Description
addDefaultFlags ( &$flags )
assertFlagsValid ( $flags )
assertLongNameValid ( $longName )
assertShortNameValid ( $shortName, $flags )
removeDashPrefix ( $string )
removeDoubleDashPrefix ( $string )

Method Details

__construct() public method

Creates a new option.
public __construct ( string $longName, string | null $shortName = null, integer $flags, string $description = null )
$longName string The long option name.
$shortName string | null The short option name.
$flags integer A bitwise combination of the option flag constants.
$description string A human-readable description of the option.

getDescription() public method

Returns the description text.
public getDescription ( ) : string
return string The description text.

getLongName() public method

The long name is prefixed with a double dash ("--") on the console.
public getLongName ( ) : string
return string The long name.

getShortName() public method

The short name is prefixed with a single dash ("-") on the console. The short name always consists of one character only.
public getShortName ( ) : string
return string The short name.

isLongNamePreferred() public method

Returns whether using the long name is preferred over using the short name.
public isLongNamePreferred ( ) : boolean
return boolean Returns `true` if the long name is preferred over the short name.

isShortNamePreferred() public method

Returns whether using the short name is preferred over using the long name.
public isShortNamePreferred ( ) : boolean
return boolean Returns `true` if the short name is preferred over the long name.

Property Details

$flags protected property

protected int $flags
return integer