Larabros\Elogram\Http\Response::hasPages PHP Method

hasPages() public method

If the response has a pagination field with a next_url key, then returns true, otherwise false.
public hasPages ( ) : boolean
return boolean
    public function hasPages()
    {
        return !empty($this->pagination) && array_key_exists('next_url', $this->pagination);
    }

Usage Example

Example #1
0
 /**
  * {@inheritDoc}
  */
 public function paginate(Response $response, $limit = null)
 {
     // If there's nothing to paginate, return response as-is
     if (!$response->hasPages() || $limit === 0) {
         return $response;
     }
     $next = $this->request('GET', $response->nextUrl());
     $merged = $response->merge($next);
     // If ``$limit`` is not set then call itself indefinitely
     if ($limit === null) {
         return $this->paginate($merged);
     }
     // If ``$limit`` is set, call itself while decrementing it each time
     $limit--;
     return $this->paginate($merged, $limit);
 }
All Usage Examples Of Larabros\Elogram\Http\Response::hasPages