You are here

public function AbstractOptions::setFromArray in Zircon Profile 8

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

Set one or more configuration properties

Parameters

array|Traversable|AbstractOptions $options:

Return value

AbstractOptions Provides fluent interface

Throws

Exception\InvalidArgumentException

1 call to AbstractOptions::setFromArray()
AbstractOptions::__construct in vendor/zendframework/zend-stdlib/src/AbstractOptions.php
Constructor

File

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

Class

AbstractOptions

Namespace

Zend\Stdlib

Code

public function setFromArray($options) {
  if ($options instanceof self) {
    $options = $options
      ->toArray();
  }
  if (!is_array($options) && !$options instanceof Traversable) {
    throw new Exception\InvalidArgumentException(sprintf('Parameter provided to %s must be an %s, %s or %s', __METHOD__, 'array', 'Traversable', 'Zend\\Stdlib\\AbstractOptions'));
  }
  foreach ($options as $key => $value) {
    $this
      ->__set($key, $value);
  }
  return $this;
}