class Options implements JsonSerializable (View source)

Options Object

An object that contains a set of options, with methods for extending, removing setting and getting values for these set options.

Methods

__construct( array $options)

Create a new Options object with a set of options.

array
getDefaults()

Returns the array of options that can be set.

array
getValues()

Returns an array representation of the options.

boolean
hasOption($option)

Checks to see if a given option is available to set.

boolean
hasValue($option)

Checks to see if a given option is set.

set( string $option, mixed $value)

Set the value of an option.

mixed
get( string $option)

Get the value of a set option.

setOptions( array $options, bool $check = true)

Batch set options from an array.

merge( Options $options)

Merges two Options objects and combines the options and values.

extend( array $options)

Extends the default options with more options.

remove( array $options)

Removes options from the default options.

array
jsonSerialize()

Custom serialization of the Options object.

Details

at line 46
__construct( array $options)

Create a new Options object with a set of options.

Parameters

array $options

Exceptions

InvalidConfigValue

at line 64
array getDefaults()

Returns the array of options that can be set.

Return Value

array

at line 75
array getValues()

Returns an array representation of the options.

Return Value

array Array of the defined options.

at line 87
boolean hasOption($option)

Checks to see if a given option is available to set.

Parameters

$option string Name of option.

Return Value

boolean

at line 99
boolean hasValue($option)

Checks to see if a given option is set.

Parameters

$option string Name of option.

Return Value

boolean

at line 117
Options set( string $option, mixed $value)

Set the value of an option.

Parameters

string $option Name of option to set.
mixed $value Value to set the option to.

Return Value

Options

Exceptions

InvalidOption

at line 136
mixed get( string $option)

Get the value of a set option.

Parameters

string $option Name of option.

Return Value

mixed

Exceptions

InvalidOption

at line 163
Options setOptions( array $options, bool $check = true)

Batch set options from an array.

The check flag can be used to bypass valid option checking (added for the customize chart method ported from the 2.5 branch)

Parameters

array $options Options to set
bool $check Flag to check options against list of set options

Return Value

Options

Exceptions

InvalidConfigValue
InvalidOption

at line 191
Options merge( Options $options)

Merges two Options objects and combines the options and values.

Parameters

Options $options

Return Value

Options

Exceptions

InvalidConfigValue

at line 206
Options extend( array $options)

Extends the default options with more options.

Parameters

array $options Array of options to extend the options.

Return Value

Options

Exceptions

InvalidConfigValue

at line 228
Options remove( array $options)

Removes options from the default options.

Parameters

array $options Array of options to remove from the options.

Return Value

Options

Exceptions

InvalidConfigValue

at line 247
array jsonSerialize()

Custom serialization of the Options object.

Return Value

array