You are here

public function AbstractOptions::__set in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-stdlib/src/AbstractOptions.php \Zend\Stdlib\AbstractOptions::__set()

Set a configuration property

Parameters

string $key:

mixed $value:

Return value

void

Throws

Exception\BadMethodCallException

Overrides ParameterObjectInterface::__set

See also

ParameterObject::__set()

2 calls to AbstractOptions::__set()
AbstractOptions::setFromArray in vendor/zendframework/zend-stdlib/src/AbstractOptions.php
Set one or more configuration properties
AbstractOptions::__unset in vendor/zendframework/zend-stdlib/src/AbstractOptions.php
Set a configuration property to NULL

File

vendor/zendframework/zend-stdlib/src/AbstractOptions.php, line 99

Class

AbstractOptions

Namespace

Zend\Stdlib

Code

public function __set($key, $value) {
  $setter = 'set' . str_replace('_', '', $key);
  if (is_callable([
    $this,
    $setter,
  ])) {
    $this
      ->{$setter}($value);
    return;
  }
  if ($this->__strictMode__) {
    throw new Exception\BadMethodCallException(sprintf('The option "%s" does not have a callable "%s" ("%s") setter method which must be defined', $key, 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))), $setter));
  }
}