public function testGetters()
 {
     $page = new Page(1, 2, 3, 4, 5);
     $this->assertEquals(1, $page->number());
     $this->assertEquals(2, $page->cursor());
     $this->assertEquals(3, $page->limit());
     $this->assertEquals(4, $page->offset());
     $this->assertEquals(5, $page->size());
 }
 /**
  * @param callable $totalAmountCallable
  * @param callable $resultsCallable
  * @param string   $route
  * @param string   $className
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function get(callable $totalAmountCallable, callable $resultsCallable, $route, $className)
 {
     try {
         QueryObject::assert($this->serializer, $this->fields, $this->included, $this->sorting, $this->errorBag, $className);
         $totalAmount = $totalAmountCallable();
         if ($totalAmount > 0 && $this->page->size() > 0 && $this->page->number() > ceil($totalAmount / $this->page->size())) {
             return $this->resourceNotFound(new ErrorBag([new OufOfBoundsError($this->page->number(), $this->page->size())]));
         }
         $links = $this->pagePaginationLinks($route, $this->page->number(), $this->page->size(), $totalAmount, $this->fields, $this->sorting, $this->included, $this->filters);
         $results = $resultsCallable();
         $paginatedResource = new PaginatedResource($this->serializer->serialize($results), $this->page->number(), $this->page->size(), $totalAmount, $links);
         $response = $this->response($paginatedResource);
     } catch (Exception $e) {
         $response = $this->getErrorResponse($e);
     }
     return $response;
 }