cubicmushroom / options-trait
Trait to make it easy to add options arrays to object classes
Installs: 23
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/cubicmushroom/options-trait
Requires (Dev)
- codeception/codeception: 2.0.10.1
This package is auto-updated.
Last update: 2025-09-28 20:38:29 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.