-
Notifications
You must be signed in to change notification settings - Fork 1
Optionable
Mistralys edited this page Apr 29, 2021
·
3 revisions
The optionable trait and matching interface are a handy tie-in to make any class support options. It provides methods like setOption(), getOption() and the like.
Trait: Traits_Optionable
Interface: Interface_Optionable
use AppUtils;
class ExampleClass implements Interface_Optionable
{
use Traits_Optionable;
public function getDefaultOptions() : array
{
return array(
'optionName' => 'default_value'
);
}
}Setting options
setOption()setOptions()
Getting options
getOption()getOptions()hasOption()
Type flavored getters
These methods guarantee the variable type that is returned.
getArrayOption()getBoolOption()getIntOption()getStringOption()
New here?
Have a look at the overview for a list of all helper classes available in the package.
Table of contents
Find the current page in the collapsible "Pages" list above, and expand the page, to view a table of contents.