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;
    }