Prismic.io PHP kit  3.0.0
Public Member Functions | Static Public Member Functions | List of all members
Prismic\Response Class Reference

Public Member Functions

 __construct ($results, $page, $resultsPerPage, $resultsSize, $totalResultsSize, $totalPages, $nextPage, $prevPage)
 
 getResults ()
 
 getPage ()
 
 getResultsPerPage ()
 
 getResultsSize ()
 
 getTotalResultsSize ()
 
 getTotalPages ()
 
 getNextPage ()
 
 getPrevPage ()
 

Static Public Member Functions

static parse (\stdClass $json)
 

Detailed Description

This class embodies a search request response from the prismic.io API, containing a list of documents, as well as meta-information about this list (mostly about pagination).

This is what is returned when you call submit() on a search request, which is the only kind of request except for the API endpoint. So, let's say that when you call prismic.io's API, you get that object a lot.

Do remember that requests in prismic.io are paginated by 20 by default.

Constructor & Destructor Documentation

§ __construct()

Prismic\Response::__construct (   $results,
  $page,
  $resultsPerPage,
  $resultsSize,
  $totalResultsSize,
  $totalPages,
  $nextPage,
  $prevPage 
)

Constructs a Response object.

Parameters
array$resultsthe list of returned documents
int$pagethe page number for this query
int$resultsPerPagethe requested number of results per page on this query
int$resultsSizethe size of the current page
int$totalResultsSizethe total number of documents, all pages together
int$totalPagesthe number of pages for this query
string$nextPagethe RESTful URL of the search request for the next page; null otherwise
string$prevPagethe RESTful URL of the search request for the previous page; null otherwise

Member Function Documentation

§ getNextPage()

Prismic\Response::getNextPage ( )

Returns the RESTful URL of the search request for the next page; null otherwise.

Returns
string the RESTful URL of the search request for the next page; null otherwise

§ getPage()

Prismic\Response::getPage ( )

Returns the page number for this query.

Returns
int the page number for this query

§ getPrevPage()

Prismic\Response::getPrevPage ( )

Returns the RESTful URL of the search request for the previous page; null otherwise.

Returns
string the RESTful URL of the search request for the previous page; null otherwise

§ getResults()

Prismic\Response::getResults ( )

Returns the list of returned documents, which is an array of Document objects.

Returns
array the list of returned documents

§ getResultsPerPage()

Prismic\Response::getResultsPerPage ( )

Returns the requested number of results per page on this query.

Returns
int the requested number of results per page on this query

§ getResultsSize()

Prismic\Response::getResultsSize ( )

Returns the size of the current page.

Returns
int the size of the current page

§ getTotalPages()

Prismic\Response::getTotalPages ( )

Returns the number of pages for this query.

Returns
int the number of pages for this query

§ getTotalResultsSize()

Prismic\Response::getTotalResultsSize ( )

Returns the total number of documents, all pages together.

Returns
int the total number of documents, all pages together

§ parse()

static Prismic\Response::parse ( \stdClass  $json)
static

Parsing a Responses from a json, unmarshalling them into PHP objects.

Parameters
$jsonthe JSON retrieved from the call
Returns
Prismic::Response the result of the call

The documentation for this class was generated from the following file: