src/Collection/ArrayCollection.php
public function chunk(int $size, bool $preserveKeys = false): ArrayCollection
    {
        $chunks = [];

        foreach (array_chunk($this->items, $size, $preserveKeys) as $chunk) {
            $chunks[] = new static($chunk);
        }

        return new static($chunks);
    }
public function chunk(int $size, bool $preserveKeys = false): ArrayCollection
    {
        $chunks = [];

        foreach (array_chunk($this->items, $size, $preserveKeys) as $chunk) {
            $chunks[] = new static($chunk);
        }

        return new static($chunks);
    }
public function chunk ( int $ size , bool $ preserveKeys = false ) : ArrayCollection { $ chunks = [ ] ; foreach ( array_chunk ( $ this -> items , $ size , $ preserveKeys ) as $ chunk ) { $ chunks [ ] = new static ( $ chunk ) ; } return new static ( $ chunks ) ; }
Creates a collection with item chunks

@param int  $size         The chunk size
@param bool $preserveKeys Whether to preserve keys

@return ArrayCollection
Creates a collection with item chunks