PHP Class Webmozart\Console\Api\Config\OptionCommandConfig

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

Public Methods

Method Description
__construct ( string $name = null, string $shortName = null, CommandConfig $parentConfig = null, ApplicationConfig $applicationConfig = null ) Creates a new configuration.
buildArgsFormat ( ArgsFormat $baseFormat = null )
getLongName ( ) : string Alias of {@link getName()}.
getShortName ( ) : string Returns the short option name of the command.
isLongNamePreferred ( ) : boolean Returns whether the long name should be preferred over the short name.
isShortNamePreferred ( ) : boolean Returns whether the short name should be preferred over the long name.
setLongName ( string $name ) : static Alias of {@link setName()}.
setName ( string $name ) : static Sets the name of the command.
setPreferLongName ( ) : static Marks the long name to be preferred over the short name.
setPreferShortName ( ) : static Marks the short name to be preferred over the long name.
setShortName ( string $shortName ) : static Sets the short option name of the command.

Method Details

__construct() public method

Creates a new configuration.
public __construct ( string $name = null, string $shortName = null, CommandConfig $parentConfig = null, ApplicationConfig $applicationConfig = null )
$name string The long option name of the command.
$shortName string The short option name of the command.
$parentConfig CommandConfig The parent configuration.
$applicationConfig ApplicationConfig The application configuration.

buildArgsFormat() public method

public buildArgsFormat ( ArgsFormat $baseFormat = null )
$baseFormat Webmozart\Console\Api\Args\Format\ArgsFormat

getLongName() public method

Alias of {@link getName()}.
public getLongName ( ) : string
return string The command name.

getShortName() public method

Returns the short option name of the command.
public getShortName ( ) : string
return string The short option name.

isLongNamePreferred() public method

If no preference was set, the short name is preferred by default if one is set. If no short name is set, the long name is preferred by default.
public isLongNamePreferred ( ) : boolean
return boolean Returns `true` if the long name should be preferred over the short name.

isShortNamePreferred() public method

If no preference was set, the short name is preferred by default if one is set. If no short name is set, the long name is preferred by default.
public isShortNamePreferred ( ) : boolean
return boolean Returns `true` if the short name should be preferred over the long name.

setLongName() public method

Alias of {@link setName()}.
public setLongName ( string $name ) : static
$name string The command name.
return static The current instance.

setName() public method

Contrary to the base implementation, the name of an option command must contain at least two characters.
public setName ( string $name ) : static
$name string The name of the command.
return static The current instance.

setPreferLongName() public method

This information is mainly used in the help where the preferred name is listed before alternative names.
public setPreferLongName ( ) : static
return static The current instance.

setPreferShortName() public method

This information is mainly used in the help where the preferred name is listed before alternative names.
public setPreferShortName ( ) : static
return static The current instance.

setShortName() public method

The short name must consist of a single letter. The short name is preceded by a single dash "-" when calling the command: $ server -d localhost In the example above, "d" is the short name of the "server --delete" command.
public setShortName ( string $shortName ) : static
$shortName string The short option name.
return static The current instance.