toArray(); } if (isset($options['options'])) { unset($options['options']); } $unknownOptions = []; foreach ((array) $options as $key => $value) { $method = 'set' . self::_normalizeKey($key); if (method_exists($object, $method)) { $object->$method($value); } else { $unknownOptions[$key] = $value; } } return $unknownOptions; } public static function setConstructorOptions($object, $options = []) { /** @var $options Zend_Config */ if ($options instanceof Zend_Config) { $options = $options->toArray(); } $_config = Qs_Config::getByInstance($object); /** @var $constructorOptions Zend_Config */ /** @var $_options Zend_Config */ if (null !== ($constructorOptions = $_config->get('__constructorOptions')) && null !== ($_options = $constructorOptions->get(get_class($object))) ) { $options = Qs_Array::mergeRecursive($options, $_options->toArray()); } if (is_array($options)) { self::setOptions($object, $options); } } protected static function _normalizeKey($key) { $option = str_replace('_', ' ', strtolower($key)); $option = str_replace(' ', '', ucwords($option)); return $option; } }