src/Hal/Application/Config/File/ConfigFileReaderJson.php
private function collapseArray(array $arr)
    {
        $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr));
        $result = [];
        foreach ($iterator as $leafValue) {
            $keys = [];
            foreach (range(0, $iterator->getDepth()) as $depth) {
                $keys[] = $iterator->getSubIterator($depth)->key();
            }
            $result[join('-', $keys)] = $leafValue;
        }

        return $result;
    }
private function collapseArray(array $arr)
    {
        $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr));
        $result = [];
        foreach ($iterator as $leafValue) {
            $keys = [];
            foreach (range(0, $iterator->getDepth()) as $depth) {
                $keys[] = $iterator->getSubIterator($depth)->key();
            }
            $result[join('-', $keys)] = $leafValue;
        }

        return $result;
    }
Collapses array into a one-dimensional one by imploding nested keys with '-'

@param array $arr

@return array