compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (5)

View Page History
* @param \Traversable $options The configuration to apply. Traversable is amongst
others implemented by Zend\Config and arrays
* @param boolean $tryCall When true and $target has a __call() function, try call if no setter is available.
* @return void Nothing
* @throws Zend\Stdlib\ConfiguratorException when no setter can be found for an option

*/
public static function configure($target, $options); $options, $tryCall=false)
{
if ( !is_object($target) )
{
throw new ConfiguratorException('Target should be an object');
}
if ( !($options instanceof Traversable) && !is_array($options) )
{
throw new ConfiguratorException('$options should implement Traversable');
}

$tryCall = (bool) $tryCall && method_exists($target, '__call');

foreach ($options as $name => &$value)
{
$setter = 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $name)));

if( $tryCall || method_exists($target,$setter) )
{
call_user_func(array($target,$setter),$value);
}
else
{
continue; // instead of throwing an exception
}
}
}

}