classes/phing/system/io/YamlFileParser.php
private function flattenArray(array $arrayToFlatten, $separator = '.', $flattenedKey = '')
    {
        $flattenedArray = [];
        foreach ($arrayToFlatten as $key => $value) {
            $tmpFlattendKey = (!empty($flattenedKey) ? $flattenedKey . $separator : '') . $key;
            // only append next value if is array and is an associative array
            if (is_array($value) && array_keys($value) !== range(0, count($value) - 1)) {
                $flattenedArray = array_merge(
                    $flattenedArray,
                    $this->flattenArray(
                        $value,
                        $separator,
                        $tmpFlattendKey
                    )
                );
            } else {
                $flattenedArray[$tmpFlattendKey] = $value;
            }
        }
        return $flattenedArray;
    }
private function flattenArray(array $arrayToFlatten, $separator = '.', $flattenedKey = '')
    {
        $flattenedArray = [];
        foreach ($arrayToFlatten as $key => $value) {
            $tmpFlattendKey = (!empty($flattenedKey) ? $flattenedKey . $separator : '') . $key;
            // only append next value if is array and is an associative array
            if (is_array($value) && array_keys($value) !== range(0, count($value) - 1)) {
                $flattenedArray = array_merge(
                    $flattenedArray,
                    $this->flattenArray(
                        $value,
                        $separator,
                        $tmpFlattendKey
                    )
                );
            } else {
                $flattenedArray[$tmpFlattendKey] = $value;
            }
        }
        return $flattenedArray;
    }
private function flattenArray ( array $ arrayToFlatten , $ separator = '.' , $ flattenedKey = '' ) { $ flattenedArray = [ ] ; foreach ( $ arrayToFlatten as $ key => $ value ) { $ tmpFlattendKey = ( ! empty ( $ flattenedKey ) ? $ flattenedKey . $ separator : '' ) . $ key ; // only append next value if is array and is an associative array if ( is_array ( $ value ) && array_keys ( $ value ) !== range ( 0 , count ( $ value ) - 1 ) ) { $ flattenedArray = array_merge ( $ flattenedArray , $ this -> flattenArray ( $ value , $ separator , $ tmpFlattendKey ) ) ; } else { $ flattenedArray [ $ tmpFlattendKey ] = $ value ; } } return $ flattenedArray ; }
Flattens an array to key => value.

@todo: milo - 20142901 - If you plan to extend phing and add a new fileparser, please move this to an abstract
class.

@param array $arrayToFlatten
Flattens an array to key = > value .