/** * It can be possible that a response was created, but some pagination was not added. * So that's why it can be added later to the response. * It should be added before the ->finalize() execution. * * @return void */ public function testCreatesResponseFromExistingResponse() { $existing = new Response(['this' => 'isData']); $response = Pagination::makeFromResponse($existing, 75, 150, 50); $this->assertInstanceOf('\\Peakfijn\\GetSomeRest\\Http\\Response', $response); $this->assertInstanceOf('\\Peakfijn\\GetSomeRest\\Http\\Pagination', $response->getPagination()); }
/** * Get the meta structure for pagination descriptions. * * @param Pagination $pagination * @return array */ protected function getPagination(Pagination $pagination) { return ['count' => $pagination->getCount(), 'offset' => $pagination->getOffset(), 'limit' => $pagination->getLimit()]; }