src/Collection/ArrayCollection.php
public function collapse(): ArrayCollection
    {
        $items = [];

        foreach ($this->items as $values) {
            if ($values instanceof self) {
                $values = $values->all();
            } elseif (!is_array($values)) {
                continue;
            }
            $items = array_merge($items, $values);
        }

        return new static($items);
    }
public function collapse(): ArrayCollection
    {
        $items = [];

        foreach ($this->items as $values) {
            if ($values instanceof self) {
                $values = $values->all();
            } elseif (!is_array($values)) {
                continue;
            }
            $items = array_merge($items, $values);
        }

        return new static($items);
    }
public function collapse ( ) : ArrayCollection { $ items = [ ] ; foreach ( $ this -> items as $ values ) { if ( $ values instanceof self ) { $ values = $ values -> all ( ) ; } elseif ( ! is_array ( $ values ) ) { continue ; } $ items = array_merge ( $ items , $ values ) ; } return new static ( $ items ) ; }
Creates a collection with items collapsed

@return ArrayCollection
Creates a collection with items collapsed