public function chunk($size, $preserveKeys = false): self
    {
        return static::create(
            \array_chunk($this->getArray(), $size, $preserveKeys),
            $this->iteratorClass,
            false
        );
    }
public function chunk($size, $preserveKeys = false): self
    {
        return static::create(
            \array_chunk($this->getArray(), $size, $preserveKeys),
            $this->iteratorClass,
            false
        );
    }
public function chunk ( $ size , $ preserveKeys = false ) : self { return static :: create ( \ array_chunk ( $ this -> getArray ( ) , $ size , $ preserveKeys ) , $ this -> iteratorClass , false ) ; }
Create a chunked version of the current array.

@param int  $size         <p>Size of each chunk.</p>
@param bool $preserveKeys <p>Whether array keys are preserved or no.</p>

@return static
<p>(Immutable) A new array of chunks from the original array.</p>
Create a chunked version of the current array .