WordPress API SDK

PaginatedResponse
in package

Table of Contents

Properties

$client  : Client
$currentPage  : int
$data  : array<int, mixed>
$endpoint  : string
$params  : array<string, mixed>
$total  : int
$totalPages  : int

Methods

__construct()  : mixed
getCurrentPage()  : int
Get current page number
getData()  : array<int, mixed>
Get the data for current page
getTotal()  : int
Get total number of items
getTotalPages()  : int
Get total number of pages
hasNextPage()  : bool
Check if there is a next page
hasPreviousPage()  : bool
Check if there is a previous page
nextPage()  : self|null
Fetch the next page, or null if this is the last page.
previousPage()  : self|null
Fetch the previous page, or null if this is the first page.
fetchPage()  : self
Fetch a specific page, mapping transport errors to SDK exceptions.

Properties

Methods

__construct()

public __construct(ResponseInterface $response, array<int, mixed> $data, Client $client, string $endpoint[, array<string, mixed> $params = [] ]) : mixed
Parameters
$response : ResponseInterface
$data : array<int, mixed>
$client : Client
$endpoint : string
$params : array<string, mixed> = []

getCurrentPage()

Get current page number

public getCurrentPage() : int
Return values
int

getData()

Get the data for current page

public getData() : array<int, mixed>
Return values
array<int, mixed>

getTotal()

Get total number of items

public getTotal() : int
Return values
int

getTotalPages()

Get total number of pages

public getTotalPages() : int
Return values
int

hasNextPage()

Check if there is a next page

public hasNextPage() : bool
Return values
bool

hasPreviousPage()

Check if there is a previous page

public hasPreviousPage() : bool
Return values
bool
On this page

Search results