$value) { $method = 'set' . self::_normalizeKey($key); if (method_exists($object, $method)) { $object->$method($value); } else { $unknownOptions[$key] = $value; } } return $unknownOptions; } protected static function _normalizeKey($key) { $option = str_replace('_', ' ', strtolower($key)); $option = str_replace(' ', '', ucwords($option)); return $option; } }