MAXIMUM_PER_PAGE
MAXIMUM_PER_PAGE
The maximum supported number of responses per page
An object to represent a list of Canvas Objects returned as a response from the Canvas API.
$api : \smtech\CanvasPest\CanvasPest
$pagination : array<mixed,\smtech\CanvasPest\CanvasPageLink>
$data : array<mixed,\smtech\CanvasPest\CanvasObject>
__construct(string $jsonResponse, \smtech\CanvasPest\CanvasPest $canvasPest)
Construct a CanvasArray
| string | $jsonResponse | A JSON-encoded response array from the Canvas API |
| \smtech\CanvasPest\CanvasPest | $canvasPest | An API object for making pagination calls |
getArrayCopy() : array<mixed,\smtech\CanvasPest\CanvasObject>
Creates a copy of the CanvasArray
offsetGet(integer|string $offset) : \smtech\CanvasPest\CanvasObject|null
Offset to retrieve
| integer|string | $offset |
offsetSet(integer|string $offset, \smtech\CanvasPest\CanvasObject $value) : void
Assign a value to the specified offset
| integer|string | $offset | |
| \smtech\CanvasPest\CanvasObject | $value |
IMMUTABLE All calls to this method will cause an exception
offsetUnset(integer|string $offset) : void
Unset an offset
| integer|string | $offset |
IMMUTABLE All calls to this method will cause an exception
| None found |
current() : \smtech\CanvasPest\CanvasObject
Return the current element
| None found |
| None found |
| None found |
| None found |
| None found |
| None found |
unserialize(string $data) : string
Construct a CanvasArray from its string representation
The data in the unserialized CanvasArray is static and cannot be refreshed, as the CanvasPest API connection is not serialized to preserve the security of API access tokens.
| string | $data |
| None found |
parsePageLinks(boolean|array<mixed,string> $headers = false) : array<mixed,\smtech\CanvasPest\CanvasPageLink>
Parse the API response link headers into pagination information
| boolean|array<mixed,string> | $headers | (Optional, defaults to |
| None found |
pageNumberToKey(integer $pageNumber) : integer|false
Convert a page number to an array key
| integer | $pageNumber | 1-indexed page number |
| None found |
requestPageNumber(integer $pageNumber, boolean $forceRefresh = false) : boolean
Request a page of responses from the API
A page of responses will be requested if it appears that that page has not yet been loaded (tested by checking if the initial element of the page has been initialized in the $data array).
| integer | $pageNumber | Page number to request |
| boolean | $forceRefresh | (Optional) Force a refresh of backing data,
even if cached (defaults to |
TRUE if the page is requested, FALSE if it is already
cached (and therefore not requested)
| None found |
requestAllPages(boolean $forceRefresh = false) : void
Request all pages from API
This stores the entire API response locally, in preparation for, most likely, serializing this object.
| boolean | $forceRefresh | (Optional) Force a refresh of backing data,
even if cached (defaults to |
| None found |