cubicmushroom / options-trait
Trait to make it easy to add options arrays to object classes
Requires (Dev)
- codeception/codeception: 2.0.10.1
This package is not auto-updated.
Last update: 2024-12-21 17:27:53 UTC
README
Options Trait
This trait is used to provide basic options setting, getting, checking, and merging with defaults
Properties
The trait add the following properties to the class...
$options
An array to the stroe the array of options in.
Methods
The trait adds the following methods to the class...
hasOption
Returns: boolean
Checks if an option is set or not
getOption
Returns: mixed
Gets a requested option.
If a second arguments is passed, will return this as the default if the option is not set. If not passed, null is returned.
setOption
Return: $this
Sets an option value
setOptions
Return: $this
Sets the options to the values given.
An optional second parameter allows for default values to be passed for options not included in the $options array.