PHP Trait Bluz\Common\Options

Example of usage class Foo { use \Bluz\Common\Options; protected $bar = ''; protected $baz = ''; public function setBar($value) { $this->bar = $value; } public function setBaz($value) { $this->baz = $value; } } $Foo = new Foo(['bar'=>123, 'baz'=>456]);
Afficher le fichier Open project: bluzphp/framework

Protected Properties

Свойство Type Description
$options options store

Méthodes publiques

Méthode Description
getOption ( string $key, string | null $section = null ) : mixed Get option by key
getOptions ( ) : array Get all options
setOption ( string $key, string $value ) : void Set option by key over setter
setOptions ( array $options ) : self Setup, check and init options

Méthodes protégées

Méthode Description
initOptions ( ) : void Check and initialize options in package

Private Methods

Méthode Description
normalizeKey ( string $key ) : string Normalize key name

Method Details

getOption() public méthode

Get option by key
public getOption ( string $key, string | null $section = null ) : mixed
$key string
$section string | null
Résultat mixed

getOptions() public méthode

Get all options
public getOptions ( ) : array
Résultat array

initOptions() protected méthode

Check and initialize options in package
protected initOptions ( ) : void
Résultat void

setOption() public méthode

Set option by key over setter
public setOption ( string $key, string $value ) : void
$key string
$value string
Résultat void

setOptions() public méthode

Requirements - options must be a array - options can be null
public setOptions ( array $options ) : self
$options array
Résultat self

Property Details

$options protected_oe property

options store
protected $options