public function chunk($size)
    {
        $collection = $this->getNewCollection();

        foreach (array_chunk($this->getKeys(), $size) as $chunkIndex => $keys) {
            $collection[$chunkIndex] = $this->getNewCollection();

            foreach ($keys as $key) {
                $collection[$chunkIndex]->append($this[$key]);
            }
        }

        return $collection;
    }
public function chunk($size)
    {
        $collection = $this->getNewCollection();

        foreach (array_chunk($this->getKeys(), $size) as $chunkIndex => $keys) {
            $collection[$chunkIndex] = $this->getNewCollection();

            foreach ($keys as $key) {
                $collection[$chunkIndex]->append($this[$key]);
            }
        }

        return $collection;
    }
public function chunk ( $ size ) { $ collection = $ this -> getNewCollection ( ) ; foreach ( array_chunk ( $ this -> getKeys ( ) , $ size ) as $ chunkIndex => $ keys ) { $ collection [ $ chunkIndex ] = $ this -> getNewCollection ( ) ; foreach ( $ keys as $ key ) { $ collection [ $ chunkIndex ] -> append ( $ this [ $ key ] ) ; } } return $ collection ; }
Splits collection into chunks

@param integer $size

@return static
Splits collection into chunks