Overview

Namespaces

  • Webmozart
    • Console
      • Adapter
      • Api
        • Application
        • Args
          • Format
        • Command
        • Config
        • Event
        • Formatter
        • IO
        • Resolver
      • Args
      • Config
      • Formatter
      • Handler
        • Help
      • IO
        • InputStream
        • OutputStream
      • Process
      • Resolver
      • UI
        • Alignment
        • Component
        • Help
        • Layout
        • Style
      • Util

Classes

  • ApplicationConfig
  • CommandConfig
  • Config
  • OptionCommandConfig
  • SubCommandConfig
  • Overview
  • Namespace
  • Class

Class OptionCommandConfig

The configuration of an option command.

Webmozart\Console\Api\Config\Config
Extended by Webmozart\Console\Api\Config\CommandConfig
Extended by Webmozart\Console\Api\Config\SubCommandConfig
Extended by Webmozart\Console\Api\Config\OptionCommandConfig
Namespace: Webmozart\Console\Api\Config
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Api/Config/OptionCommandConfig.php
Methods summary
public
# __construct( string $name = null, string $shortName = null, Webmozart\Console\Api\Config\CommandConfig $parentConfig = null, Webmozart\Console\Api\Config\ApplicationConfig $applicationConfig = null )

Creates a new configuration.

Creates a new configuration.

Parameters

$name
The long option name of the command.
$shortName
The short option name of the command.
$parentConfig
The parent configuration.
$applicationConfig
The application configuration.

Overrides

Webmozart\Console\Api\Config\SubCommandConfig::__construct()
public static
# setName( string $name )

Sets the name of the command.

Sets the name of the command.

Contrary to the base implementation, the name of an option command must contain at least two characters.

Parameters

$name
The name of the command.

Returns

static
The current instance.

Overrides

Webmozart\Console\Api\Config\CommandConfig::setName()
public string
# getLongName( )

Alias of Webmozart\Console\Api\Config\CommandConfig::getName().

Alias of Webmozart\Console\Api\Config\CommandConfig::getName().

Returns

string
The command name.
public static
# setLongName( string $name )

Alias of Webmozart\Console\Api\Config\OptionCommandConfig::setName().

Alias of Webmozart\Console\Api\Config\OptionCommandConfig::setName().

Parameters

$name
The command name.

Returns

static
The current instance.
public string
# getShortName( )

Returns the short option name of the command.

Returns the short option name of the command.

Returns

string
The short option name.
public static
# setShortName( string $shortName )

Sets the short option name of the command.

Sets the short option name of the command.

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.

Parameters

$shortName
The short option name.

Returns

static
The current instance.
public static
# setPreferLongName( )

Marks the long name to be preferred over the short name.

Marks the long name to be preferred over the short name.

This information is mainly used in the help where the preferred name is listed before alternative names.

Returns

static
The current instance.

See

Webmozart\Console\Api\Config\OptionCommandConfig::isLongNamePreferred(), Webmozart\Console\Api\Config\OptionCommandConfig::setPreferShortName()
public static
# setPreferShortName( )

Marks the short name to be preferred over the long name.

Marks the short name to be preferred over the long name.

This information is mainly used in the help where the preferred name is listed before alternative names.

Returns

static
The current instance.

See

Webmozart\Console\Api\Config\OptionCommandConfig::isShortNamePreferred(), Webmozart\Console\Api\Config\OptionCommandConfig::setPreferLongName()
public boolean
# isLongNamePreferred( )

Returns whether the long name should be preferred over the short name.

Returns whether the long name should be preferred over the short name.

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.

Returns

boolean

Returns true if the long name should be preferred over the short name.

See

Webmozart\Console\Api\Config\OptionCommandConfig::setPreferLongName(), Webmozart\Console\Api\Config\OptionCommandConfig::isShortNamePreferred()
public boolean
# isShortNamePreferred( )

Returns whether the short name should be preferred over the long name.

Returns whether the short name should be preferred over the long name.

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.

Returns

boolean

Returns true if the short name should be preferred over the long name.

See

Webmozart\Console\Api\Config\OptionCommandConfig::setPreferShortName(), Webmozart\Console\Api\Config\OptionCommandConfig::isLongNamePreferred()
public Webmozart\Console\Api\Args\Format\ArgsFormat
# buildArgsFormat( Webmozart\Console\Api\Args\Format\ArgsFormat $baseFormat = null )

Builds an Webmozart\Console\Api\Args\Format\ArgsFormat instance with the given base format.

Builds an Webmozart\Console\Api\Args\Format\ArgsFormat instance with the given base format.

Parameters

$baseFormat
The base format.

Returns

Webmozart\Console\Api\Args\Format\ArgsFormat
The built format for the console arguments.

Overrides

Webmozart\Console\Api\Config\CommandConfig::buildArgsFormat()
Methods inherited from Webmozart\Console\Api\Config\SubCommandConfig
end(), getDefaultArgsParser(), getDefaultHandler(), getDefaultHandlerMethod(), getDefaultHelperSet(), getDefaultLenientArgsParsing(), getParentConfig(), setParentConfig()
Methods inherited from Webmozart\Console\Api\Config\CommandConfig
addAlias(), addAliases(), addSubCommandConfig(), addSubCommandConfigs(), beginOptionCommand(), beginSubCommand(), create(), disable(), disableIf(), editOptionCommand(), editSubCommand(), enable(), enableIf(), getAliases(), getApplicationConfig(), getDescription(), getHelp(), getName(), getProcessTitle(), getSubCommandConfig(), getSubCommandConfigs(), hasSubCommandConfig(), hasSubCommandConfigs(), isAnonymous(), isDefault(), isEnabled(), markAnonymous(), markDefault(), markNoDefault(), setAliases(), setApplicationConfig(), setDescription(), setHelp(), setProcessTitle(), setSubCommandConfigs()
Methods inherited from Webmozart\Console\Api\Config\Config
addArgument(), addOption(), configure(), disableLenientArgsParsing(), enableLenientArgsParsing(), getArgsParser(), getArguments(), getHandler(), getHandlerMethod(), getHelperSet(), getOptions(), isLenientArgsParsingEnabled(), setArgsParser(), setHandler(), setHandlerMethod(), setHelperSet()
Webmozart Console API API documentation generated by ApiGen