src/GeneratorCollection.php
public function takeFirst(int $count)
    {
        return $this->wrap(function (Iterator $data) use ($count) {
            $first = true;

            while ($count-- && $data->valid()) {
                if (!$first) {
                    $data->next();
                }

                yield $data->key() => $data->current();
                $first = false;
            }
        });
    }
public function takeFirst(int $count)
    {
        return $this->wrap(function (Iterator $data) use ($count) {
            $first = true;

            while ($count-- && $data->valid()) {
                if (!$first) {
                    $data->next();
                }

                yield $data->key() => $data->current();
                $first = false;
            }
        });
    }
public function takeFirst ( int $ count ) { return $ this -> wrap ( function ( Iterator $ data ) use ( $ count ) { $ first = true ; while ( $ count -- && $ data -> valid ( ) ) { if ( ! $ first ) { $ data -> next ( ) ; } yield $ data -> key ( ) => $ data -> current ( ) ; $ first = false ; } } ) ; }
Take items from the beginning of the collection

@param int $count
@return \Buttress\Collection\CollectionInterface
Take items from the beginning of the collection