private static function doCompact(array $array, $integerKeysIncluded = true)
    {
        $result = array();

        foreach ($array as $key => $value) {
            $escapedKey = self::escapeKey($key);
            $extraKeyPath = "";

            while (self::isCompactableArray($value, $integerKeysIncluded)) {
                $nextValue = reset($value);
                $compactKey = key($value);

                $extraKeyPath .= "." . self::escapeKey($compactKey);
                $value = $nextValue;
            }

            $result[$escapedKey . $extraKeyPath] = self::compactValue($value);
        }

        return $result;
    }
private static function doCompact(array $array, $integerKeysIncluded = true)
    {
        $result = array();

        foreach ($array as $key => $value) {
            $escapedKey = self::escapeKey($key);
            $extraKeyPath = "";

            while (self::isCompactableArray($value, $integerKeysIncluded)) {
                $nextValue = reset($value);
                $compactKey = key($value);

                $extraKeyPath .= "." . self::escapeKey($compactKey);
                $value = $nextValue;
            }

            $result[$escapedKey . $extraKeyPath] = self::compactValue($value);
        }

        return $result;
    }
private static function doCompact ( array $ array , $ integerKeysIncluded = true ) { $ result = array ( ) ; foreach ( $ array as $ key => $ value ) { $ escapedKey = self :: escapeKey ( $ key ) ; $ extraKeyPath = "" ; while ( self :: isCompactableArray ( $ value , $ integerKeysIncluded ) ) { $ nextValue = reset ( $ value ) ; $ compactKey = key ( $ value ) ; $ extraKeyPath .= "." . self :: escapeKey ( $ compactKey ) ; $ value = $ nextValue ; } $ result [ $ escapedKey . $ extraKeyPath ] = self :: compactValue ( $ value ) ; } return $ result ; }
Compact an expanded array to a DotNotation array.

@param array $array
@param bool $integerKeysIncluded Whether to flatten integer keys as well.
@return array The flattened array.
Compact an expanded array to a DotNotation array .