private function normalizeArray(array &$data)
    {
        $normalizedData = array();

        foreach ($data as $key => $val) {
            $normalizedKey = $this->normalizeString($key);

            if ($normalizedKey !== $key) {
                if (array_key_exists($normalizedKey, $normalizedData)) {
                    throw new NormalizationException(sprintf(
                        'The key "%s" is invalid as it will override the existing key "%s"',
                        $key,
                        $normalizedKey
                    ));
                }
            }

            $normalizedData[$normalizedKey] = $val;
            $key = $normalizedKey;

            if (is_array($val)) {
                $this->normalizeArray($normalizedData[$key]);
            }
        }

        $data = $normalizedData;
    }
private function normalizeArray(array &$data)
    {
        $normalizedData = array();

        foreach ($data as $key => $val) {
            $normalizedKey = $this->normalizeString($key);

            if ($normalizedKey !== $key) {
                if (array_key_exists($normalizedKey, $normalizedData)) {
                    throw new NormalizationException(sprintf(
                        'The key "%s" is invalid as it will override the existing key "%s"',
                        $key,
                        $normalizedKey
                    ));
                }
            }

            $normalizedData[$normalizedKey] = $val;
            $key = $normalizedKey;

            if (is_array($val)) {
                $this->normalizeArray($normalizedData[$key]);
            }
        }

        $data = $normalizedData;
    }
private function normalizeArray ( array & $ data ) { $ normalizedData = array ( ) ; foreach ( $ data as $ key => $ val ) { $ normalizedKey = $ this -> normalizeString ( $ key ) ; if ( $ normalizedKey !== $ key ) { if ( array_key_exists ( $ normalizedKey , $ normalizedData ) ) { throw new NormalizationException ( sprintf ( 'The key "%s" is invalid as it will override the existing key "%s"' , $ key , $ normalizedKey ) ) ; } } $ normalizedData [ $ normalizedKey ] = $ val ; $ key = $ normalizedKey ; if ( is_array ( $ val ) ) { $ this -> normalizeArray ( $ normalizedData [ $ key ] ) ; } } $ data = $ normalizedData ; }
Normalizes an array.

@param array &$data

@throws Exception\NormalizationException
Normalizes an array .