XenForo options accessor class.

package XenForo_Options

 Methods

Constructor.

__construct(array $options) 

Sets up the accessor using the provided options.

Parameters

$options

array

Collection of options. Keys represent option names.

Magic getter for first-order options.

__get(string $option) : null | mixed

This method cannot be used for getting a sub-option! You must use get() for that.

This is equivalent to calling get() with no sub-option, which means the "main" sub-option will be returned (if applicable).

Parameters

$option

string

Returns

nullmixed

Returns true if the named option exists.

__isset(string $option) : boolean

Do not use this approach for sub-options!

This is equivalent to calling get() with no sub-option, which means the "main" sub-option will be returned (if applicable).

Parameters

$option

string

Returns

boolean

Magic set method.

__set(string $name, mixed $value) 

Only sets whole options.

Parameters

$name

string

$value

mixed

Gets an option.

get(string $optionName, null | false | string $subOption) : null | mixed

If the option exists and is an array, then... * if no sub-option is specified but an $optionName key exists in the option, return the value for that key * if no sub-option is specified and no $optionName key exists, return the whole option array * if the sub-option === false, the entire option is returned, regardless of what keys exist * if a sub-option is specified and the key exists, return the value for that key * if a sub-option is specified and the key does not exist, return null If the option is not an array, then the value of the option is returned (provided no sub-option is specified). Otherwise, null is returned.

Parameters

$optionName

string

Name of the option

$subOption

nullfalsestring

Sub-option. See above for usage.

Returns

nullmixedNull if the option doesn't exist (see above) or the option's value.

Gets all options in their raw form.

getOptions() : array

Returns

array

Sets an option or a particular sub-option (first level array key).

set(string $option, mixed $subOption, mixed | null $value) 

Parameters

$option

string

$subOption

mixed

If $value is null, then this is treated as the value; otherwise, a specific array key to change

$value

mixednull

If null, ignored

Sets the collection of options manually.

setOptions(array $options) 

Parameters

$options

array

 Properties

 

$_options : array