src/CanvasPest.php
protected function postprocessResponse($response)
    {
        if (substr($response, 0, 1) == '{') {
            return new CanvasObject($response);
        } elseif (substr($response, 0, 1) == '[') {
            return new CanvasArray($response, $this);
        } else {
            if ($this->throw_exceptions) {
                throw new CanvasPest_Exception(
                    $response,
                    CanvasPest_Exception::INVALID_JSON_RESPONSE
                );
            }
            return false;
        }
    }
protected function postprocessResponse($response)
    {
        if (substr($response, 0, 1) == '{') {
            return new CanvasObject($response);
        } elseif (substr($response, 0, 1) == '[') {
            return new CanvasArray($response, $this);
        } else {
            if ($this->throw_exceptions) {
                throw new CanvasPest_Exception(
                    $response,
                    CanvasPest_Exception::INVALID_JSON_RESPONSE
                );
            }
            return false;
        }
    }
Parse the API response into an object (or collection of objects).

For queries to individually identified endpoints (e.g.
`accounts/1/users/123`), return a CanvasObject representing the API response
describing _that_ individually identified object affected by the query.

For queries to generic endpoints (e.g. `accounts/1/users`), return a
traversable CanvasArray (of CanvasObjects) representing the API response
describing the list of objects affected by the query.

@param string $response JSON-encoded response from the API

@return CanvasObject|CanvasArray|false

@throws CanvasPest_Exception INVALID_JSON_RESPONSE if an
non-JSON-formatted response is received (and
$this->throw_exceptions is true -- otherwise it returns false)