static function setAttributes(
		array $map
		, &$obj
		, $visibilityFlags = null
		, $setterPrefix = 'set'
		, $useCamelCase = true
		) {
		$flags = null === $visibilityFlags ? self::allFlags() : $visibilityFlags;
		$reflectionObject = new \ReflectionObject( $obj );
		$currentClass = new \ReflectionClass( $obj );
		while ( $currentClass !== false && ! $currentClass->isInterface() ) {
		
			$properties = $currentClass->getProperties( $flags );
				
			foreach ( $properties as $property ) {
				
				$attributeName = $property->getName();
				$methodName = $setterPrefix .
					( $useCamelCase ? self::mb_ucfirst( $attributeName ) : $attributeName );
				
				if ( $property->isPrivate() || $property->isProtected() ) {
					
					if ( $reflectionObject->hasMethod( $methodName ) ) {
						
						$method = $reflectionObject->getMethod( $methodName );
						if ( $method->isPublic() && array_key_exists( $attributeName, $map ) ) {
							$method->invoke( $obj, $map[ $attributeName ] );
						}
					}
					
				} else { // public
					try {
						if ( array_key_exists( $attributeName, $map ) ) {
							$obj->{ $attributeName } = $map[ $attributeName ];
						}
					} catch ( \Exception $e ) {
						// Ignore
					}
				}
			}
			
			// No properties? -> try to retrieve only public properties
			if ( count( $properties ) < 1 ) {
				$properties = get_object_vars( $obj );
				foreach ( $properties as $attributeName => $v ) {
					if ( array_key_exists( $attributeName, $map ) ) { 
						try {
							$obj->{ $attributeName } = $map[ $attributeName ];
						} catch ( \Exception $e ) {
							// Ignore
						}
					}
				}
			}			
			
			$currentClass = $currentClass->getParentClass();
		}
	}