OptionSet

class OptionSet

A set of options.

Copyright
2016 Appertly contributors
License
MIT

Constructors / Destructors

Public
ReturnsSignature and Description
void
__construct(Option... $options)

Creates a new OptionSet.

Instance Methods

Public
ReturnsSignature and Description
OptionSet

Combines this OptionSet with another.

string

Gets a formatted help string for the option set.

?Option
getOption(string $label)

Gets an Option by label.

ImmVector<Option>

Gets the options.

Method Details

__construct

public function __construct(Option... $options)

Creates a new OptionSet.

Parameters
NameTypeDescription
$optionsOption

The options to add

Throws
TypeConditions
InvalidArgumentException

if any option labels collide

combine

public function combine(OptionSet $other)

Combines this OptionSet with another.

Parameters
NameTypeDescription
$otherOptionSet

The other options

Returns
TypeDescription
OptionSet

The new combined option set

Throws
TypeConditions
InvalidArgumentException

if any option labels collide

getHelp

public function getHelp()

Gets a formatted help string for the option set.

Returns
TypeDescription
string

a formatted help string

getOption

public function getOption(string $label)

Gets an Option by label.

Parameters
NameTypeDescription
$labelstring

The label

Returns
TypeDescription
?Option

The option found or null

getOptions

public function getOptions()

Gets the options.

Returns
TypeDescription
ImmVector<Option>

The options