Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge pull request zendframework/zendframework#1 from wryck7/ZendHydr…
Browse files Browse the repository at this point in the history
…ator

CS fixes
  • Loading branch information
mabuzagu committed Apr 15, 2013
2 parents cbd155f + a242a20 commit 8711a71
Show file tree
Hide file tree
Showing 26 changed files with 738 additions and 560 deletions.
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"autoload": {
"psr-4": {
"Zend\\Stdlib\\": "src/"
},
"files": [
"Zend/Stdlib/compatibility/autoload.php"
]
}
},
"require": {
"php": ">=5.3.3"
Expand All @@ -36,8 +33,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
"dev-master": "2.1-dev",
"dev-develop": "2.2-dev"
}
},
"autoload-dev": {
Expand Down
22 changes: 19 additions & 3 deletions src/AbstractOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ abstract class AbstractOptions implements ParameterObjectInterface
protected $__strictMode__ = true;

/**
* Constructor
*
* @param array|Traversable|null $options
*/
public function __construct($options = null)
Expand All @@ -32,22 +34,29 @@ public function __construct($options = null)
}

/**
* @param array|Traversable $options
* Set one or more configuration properties
*
* @param array|Traversable|AbstractOptions $options
* @throws Exception\InvalidArgumentException
* @return AbstractOptions Provides fluent interface
*/
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 array or Traversable',
__METHOD__
'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;
}

Expand All @@ -72,6 +81,8 @@ public function toArray()
}

/**
* Set a configuration property
*
* @see ParameterObject::__set()
* @param string $key
* @param mixed $value
Expand All @@ -94,6 +105,8 @@ public function __set($key, $value)
}

/**
* Get a configuration property
*
* @see ParameterObject::__get()
* @param string $key
* @throws Exception\BadMethodCallException
Expand All @@ -114,6 +127,7 @@ public function __get($key)
}

/**
* Test if a configuration property is null
* @see ParameterObject::__isset()
* @param string $key
* @return bool
Expand All @@ -124,6 +138,8 @@ public function __isset($key)
}

/**
* Set a configuration property to NULL
*
* @see ParameterObject::__unset()
* @param string $key
* @throws Exception\InvalidArgumentException
Expand Down
Loading

0 comments on commit 8711a71

Please sign in to comment.