class OptionsArray extends Component (View source)

Parses a list of options.

Properties

array $options

ArrayObj of selected options.

Methods

static mixed
parse(Parser $parser, TokensList $list, array $options = [])

No description

static mixed
build(mixed $component, array $options = [])

No description

string
__toString()

Builds the string representation of a component of this type.

__construct(array $options = [])

No description

mixed
has(string $key, bool $getExpr = false)

Checks if it has the specified option and returns it value or true.

bool
remove(string $key)

Removes the option from the array.

merge(array|OptionsArray $options)

Merges the specified options with these ones. Values with same ID will be replaced.

bool
isEmpty()

Checks tf there are no options set.

Details

static mixed parse(Parser $parser, TokensList $list, array $options = [])

No description

Parameters

Parser $parser

the parser that serves as context

TokensList $list

the list of tokens that are being parsed

array $options

parameters for parsing

Return Value

mixed

static mixed build(mixed $component, array $options = [])

No description

Parameters

mixed $component

the component to be built

array $options

parameters for building

Return Value

mixed

string __toString()

Builds the string representation of a component of this type.

Return Value

string

See also

static::build

__construct(array $options = [])

No description

Parameters

array $options

The array of options. Options that have a value must be an array with at least two keys name and expr or value.

mixed has(string $key, bool $getExpr = false)

Checks if it has the specified option and returns it value or true.

Parameters

string $key

the key to be checked

bool $getExpr

Gets the expression instead of the value. The value is the processed form of the expression.

Return Value

mixed

bool remove(string $key)

Removes the option from the array.

Parameters

string $key

the key to be removed

Return Value

bool

whether the key was found and deleted or not

merge(array|OptionsArray $options)

Merges the specified options with these ones. Values with same ID will be replaced.

Parameters

array|OptionsArray $options

the options to be merged

bool isEmpty()

Checks tf there are no options set.

Return Value

bool