public static function collapse(array $array) : array
    {
        $results = [];

        foreach ($array as $key => $item) {

            // Nested arrays will be merged in (non-recursively).
            if (is_array($item)) {
                $results = array_merge($results, $item); continue;
            }

            // Values with numeric keys will be appended in any case.
            if (is_int($key)) {
                $results[] = $item; continue;
            }

            // Non-numeric keys. If we've got the given key in $results already, it means it was merged
            // in from one of the nested arrays and those are meant to overwrite the initial values on collisions -
            // thus we're not going to do anything in that case.
            if (!array_key_exists($key, $results)) {
                $results[$key] = $item;
            }
        }

        return $results;
    }