public static function filesFlip(&$result, $keys, $value)
    {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $newKeys = $keys;
                array_push($newKeys, $k);
                self::filesFlip($result, $newKeys, $v);
            }
        } else {
            $res = $value;
            // Move the innermost key to the outer spot
            $first = array_shift($keys);
            array_push($keys, $first);
            foreach (array_reverse($keys) as $k) {
                // You might think we'd say $res[$k] = $res, but $res starts out not as an array
                $res = [$k => $res];
            }

            $result = array_replace_recursive($result, $res);
        }
    }