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

Changes (5)

View Page History
* The component *will* align with coding standards and practices.
* The component *will not* have any knowledge of the target object.
* The component *will* allow option names to be passed as both underscored words.
* The component *will* treat option names case insensitive.
* The component *will* require the target object to have setters for each configurable option.

Zend\Stdlib\Configurator will accept a target object and a Zend\Config object. Instead of a Zend\Config object, an array may be passed.
Zend\Stdlib\Configurator will accept a target object and an object implementing Traversable. This includes Zend\Config objects and plain arrays.

For each option passed, the Configurator will call the appropriate setter with the value provided. Option names are stripped of underscores before resolving the setter. Since call_user_method(), is_callback() and method_exists() are case sensitive, option names are practically case insensitive.

Since no state has to be maintained, the Configurator will be implemented as a class with only static methods.

class Configurator {
/** Configure a target object with the provided options.
* The options passed in must be a Traversable object with option names for keys.
* Option names are case insensitive and will be stripped of underscores. By convention,
* option names are in lowercase and with underscores separated words.
* The target object is expected to have a setter method for each option passed. By convention,
* setters are named using camelcase with a 'set' prefix.
* Example: option_name -> setOptionName()
* @param object $target The object that needs to be configured.
* @param \Traversable $options The configuration to apply. Traversable is amongst
others implemented by Zend\Config and arrays
* @return void Nothing
* @throws Zend\Stdlib\ConfiguratorException when no setter can be found for an option
public static function configure($target, $options);