class DefaultsWithDescriptions (View source)

An associative array that maps from key to default value; each entry can also have a description and suggested values.

Properties

protected array $values
protected array $hasDefault
protected array $descriptions
protected array $suggestedValues
protected mixed $defaultDefault

Methods

__construct($values = [], $defaultDefault = null)

No description

array
getValues()

Return just the key : default values mapping

isEmpty()

Return true if this set of options is empty

bool
exists(string $key)

Check to see whether the speicifed key exists in the collection.

string
get(string $key)

Get the value of one entry.

string
removeMatching(string $key)

Remove a matching entry, if it exists.

approximatelyMatchingKey($key)

No description

simplifyKey($key)

No description

string
getDescription(string $key)

Get the description of one entry.

array|Closure
getSuggestedValues(string $key)

Get the suggested values for an item.

add(string $key, string $description = '', mixed $defaultValue = null, $suggestedValues = [])

Add another argument to this command.

setDefaultValue(string $key, mixed $defaultValue)

Change the default value of an entry.

bool
hasDefault(string $key)

Check to see if the named argument definitively has a default value.

clear(string $key)

Remove an entry

rename($oldName, $newName)

Rename an existing option to something else.

Details

__construct($values = [], $defaultDefault = null)

No description

Parameters

$values
$defaultDefault

array getValues()

Return just the key : default values mapping

Return Value

array

isEmpty()

Return true if this set of options is empty

bool exists(string $key)

Check to see whether the speicifed key exists in the collection.

Parameters

string $key

Return Value

bool

string get(string $key)

Get the value of one entry.

Parameters

string $key

The key of the item.

Return Value

string

string removeMatching(string $key)

Remove a matching entry, if it exists.

Parameters

string $key

The key of the value to remove

Return Value

string

The value of the removed item, or empty

approximatelyMatchingKey($key)

No description

Parameters

$key

protected simplifyKey($key)

No description

Parameters

$key

string getDescription(string $key)

Get the description of one entry.

Parameters

string $key

The key of the item.

Return Value

string

array|Closure getSuggestedValues(string $key)

Get the suggested values for an item.

Parameters

string $key

The key of the item.

Return Value

array|Closure

add(string $key, string $description = '', mixed $defaultValue = null, $suggestedValues = [])

Add another argument to this command.

Parameters

string $key

Name of the argument.

string $description

Help text for the argument.

mixed $defaultValue

The default value for the argument.

$suggestedValues

setDefaultValue(string $key, mixed $defaultValue)

Change the default value of an entry.

Parameters

string $key
mixed $defaultValue

bool hasDefault(string $key)

Check to see if the named argument definitively has a default value.

Parameters

string $key

Return Value

bool

clear(string $key)

Remove an entry

Parameters

string $key

The entry to remove

rename($oldName, $newName)

Rename an existing option to something else.

Parameters

$oldName
$newName