\smtech\CanvasPestCanvasObject

An object that represents a single Canvas object, providing both object- style access (obj->key) and array-style access (array[key]).

CanvasObject objects are immutable, so attempts to change their underlying data will result in exceptions.

A CanvasObject is returned from any API request for which the endpoint ends with a specific ID number (e.g. http://example.com/api/v1/accounts/1/users/1).

Summary

Methods
Properties
Constants
__construct()
__isset()
__get()
__set()
__unset()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
serialize()
unserialize()
getArrayCopy()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$data
N/A

Properties

$data

$data : array

Type

array — Backing store

Methods

__construct()

__construct(string|array<mixed,string>  $response) 

Construct a CanvasObject

Parameters

string|array<mixed,string> $response

JSON-encoded response from the Canvas API or the resulting JSON-decoded associative array

__isset()

__isset(string  $key) : boolean

Whether a property exists

Parameters

string $key

Returns

boolean

__get()

__get(string  $key) : mixed

Property to retrieve

Parameters

string $key

Returns

mixed

__set()

__set(string  $key, mixed  $value) : void

Whether a property exists

Parameters

string $key
mixed $value

Throws

\smtech\CanvasPest\CanvasObject_Exception

IMMUTABLE All calls to this method will cause an exception

__unset()

__unset(string  $key) : void

Unset a property

Parameters

string $key

Throws

\smtech\CanvasPest\CanvasObject_Exception

IMMUTABLE All calls to this method will cause an exception

offsetExists()

offsetExists(integer|string  $offset) : boolean

Whether an offset exists

Parameters

integer|string $offset

Returns

boolean

offsetGet()

offsetGet(integer|string  $offset) : mixed|null

Offset to retrieve

Parameters

integer|string $offset

Returns

mixed|null

offsetSet()

offsetSet(integer|string  $offset, mixed  $value) : void

Assign a value to the specified offset

Parameters

integer|string $offset
mixed $value

Throws

\smtech\CanvasPest\CanvasObject_Exception

IMMUTABLE All calls to this method will cause an exception

offsetUnset()

offsetUnset(integer|string  $offset) : void

Unset an offset

Parameters

integer|string $offset

Throws

\smtech\CanvasPest\CanvasObject_Exception

IMMUTABLE All calls to this method will cause an exception

serialize()

serialize() : string

String representation of CanvasObject

Returns

string

unserialize()

unserialize(string  $data) : void

Construct a CanvasObject from its string representation

Parameters

string $data

getArrayCopy()

getArrayCopy() : array

An array representation of the CanvasObject

Returns

array