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

  • AbstractOption
  • ArgsFormat
  • ArgsFormatBuilder
  • Argument
  • CommandName
  • CommandOption
  • Option

Exceptions

  • InvalidValueException
  • Overview
  • Namespace
  • Class

Class AbstractOption

Base class for command line options.

Direct known subclasses

Webmozart\Console\Api\Args\Format\CommandOption, Webmozart\Console\Api\Args\Format\Option
Abstract
Namespace: Webmozart\Console\Api\Args\Format
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Api/Args/Format/AbstractOption.php
Methods summary
public
# __construct( string $longName, string|null $shortName = null, integer $flags = 0, string $description = null )

Creates a new option.

Creates a new option.

Parameters

$longName
The long option name.
$shortName
The short option name.
$flags

A bitwise combination of the option flag constants.

$description
A human-readable description of the option.

Throws

Webmozart\Console\Api\Args\Format\InvalidValueException
If the default value is invalid.
public string
# getLongName( )

Returns the long option name.

Returns the long option name.

The long name is prefixed with a double dash ("--") on the console.

Returns

string
The long name.
public boolean
# isLongNamePreferred( )

Returns whether using the long name is preferred over using the short name.

Returns whether using the long name is preferred over using the short name.

Returns

boolean

Returns true if the long name is preferred over the short name.

public string
# getShortName( )

Returns the short option name.

Returns the short option name.

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

Returns

string
The short name.
public boolean
# isShortNamePreferred( )

Returns whether using the short name is preferred over using the long name.

Returns whether using the short name is preferred over using the long name.

Returns

boolean

Returns true if the short name is preferred over the long name.

public string
# getDescription( )

Returns the description text.

Returns the description text.

Returns

string
The description text.
Constants summary
integer PREFER_LONG_NAME

Flag: Prefer usage of the long option name.

Flag: Prefer usage of the long option name.

# 1
integer PREFER_SHORT_NAME

Flag: Prefer usage of the short option name.

Flag: Prefer usage of the short option name.

# 2
Properties summary
protected integer $flags
#
Webmozart Console API API documentation generated by ApiGen