Data/DataContainer.php
protected function normalizeValue($value)
    {
        $normalizedValue = $value;
        // object value
        if (is_object($value)) {
            if (get_class($value) === "DateTime") {
                $normalizedValue = $value->format("Y-m-d\TH:i:s.u\Z");
            } elseif ($value instanceof DataContainerInterface || method_exists($value, 'normalizeData')) {
                $normalizedValue = $value->normalizeData();
            } else {
                throw new PropertyValueNormalizationException(
                    "Value error: object of type [" . get_class($value) . "]
                    does not implement DataContainerInterface nor have a [normalizeData] method"
                );
            }
        } elseif (is_array($value)) {
            foreach ($value as $arrProperty => $arrValue) {
                $normalizedValue[$arrProperty] = $this->normalizeValue($arrValue);
            }
        }

        return $normalizedValue;
    }
protected function normalizeValue($value)
    {
        $normalizedValue = $value;
        // object value
        if (is_object($value)) {
            if (get_class($value) === "DateTime") {
                $normalizedValue = $value->format("Y-m-d\TH:i:s.u\Z");
            } elseif ($value instanceof DataContainerInterface || method_exists($value, 'normalizeData')) {
                $normalizedValue = $value->normalizeData();
            } else {
                throw new PropertyValueNormalizationException(
                    "Value error: object of type [" . get_class($value) . "]
                    does not implement DataContainerInterface nor have a [normalizeData] method"
                );
            }
        } elseif (is_array($value)) {
            foreach ($value as $arrProperty => $arrValue) {
                $normalizedValue[$arrProperty] = $this->normalizeValue($arrValue);
            }
        }

        return $normalizedValue;
    }
protected function normalizeValue ( $ value ) { $ normalizedValue = $ value ; // object value if ( is_object ( $ value ) ) { if ( get_class ( $ value ) === "DateTime" ) { $ normalizedValue = $ value -> format ( "Y-m-d\TH:i:s.u\Z" ) ; } elseif ( $ value instanceof DataContainerInterface || method_exists ( $ value , 'normalizeData' ) ) { $ normalizedValue = $ value -> normalizeData ( ) ; } else { throw new PropertyValueNormalizationException ( "Value error: object of type [" . get_class ( $ value ) . "]
                    does not implement DataContainerInterface nor have a [normalizeData] method" ) ; } } elseif ( is_array ( $ value ) ) { foreach ( $ value as $ arrProperty => $ arrValue ) { $ normalizedValue [ $ arrProperty ] = $ this -> normalizeValue ( $ arrValue ) ; } } return $ normalizedValue ; }
Normalize a property value
@param $value
@return mixed
@throws PropertyValueNormalizationException
Normalize a property value