src/Common/ApiCollection.php
public function setPaginator($class, $options = [])
    {
        $interfaces = class_implements($class);

        if (in_array('Illuminate\Contracts\Pagination\LengthAwarePaginator', $interfaces)) {
            $paginator = new $class($this->items, $this->total, $this->perPage, $this->currentPage, $options);
        } elseif (in_array('Illuminate\Contracts\Pagination\Paginator', $interfaces)) {
            $paginator = new $class($this->items, $this->perPage, $this->currentPage, $options);
            $paginator->hasMorePagesWhen($this->hasMore);
        } else {
            throw new \InvalidArgumentException('Cannot use the given paginator.');
        }

        $this->paginator = $paginator;
    }
public function setPaginator($class, $options = [])
    {
        $interfaces = class_implements($class);

        if (in_array('Illuminate\Contracts\Pagination\LengthAwarePaginator', $interfaces)) {
            $paginator = new $class($this->items, $this->total, $this->perPage, $this->currentPage, $options);
        } elseif (in_array('Illuminate\Contracts\Pagination\Paginator', $interfaces)) {
            $paginator = new $class($this->items, $this->perPage, $this->currentPage, $options);
            $paginator->hasMorePagesWhen($this->hasMore);
        } else {
            throw new \InvalidArgumentException('Cannot use the given paginator.');
        }

        $this->paginator = $paginator;
    }
public function setPaginator ( $ class , $ options = [ ] ) { $ interfaces = class_implements ( $ class ) ; if ( in_array ( 'Illuminate\Contracts\Pagination\LengthAwarePaginator' , $ interfaces ) ) { $ paginator = new $ class ( $ this -> items , $ this -> total , $ this -> perPage , $ this -> currentPage , $ options ) ; } elseif ( in_array ( 'Illuminate\Contracts\Pagination\Paginator' , $ interfaces ) ) { $ paginator = new $ class ( $ this -> items , $ this -> perPage , $ this -> currentPage , $ options ) ; $ paginator -> hasMorePagesWhen ( $ this -> hasMore ) ; } else { throw new \ InvalidArgumentException ( 'Cannot use the given paginator.' ) ; } $ this -> paginator = $ paginator ; }
Set a paginator for this collection.

@param string $class
@param array $options
Set a paginator for this collection .