EasyPost\Requestor::_interpretResponse PHP Method

_interpretResponse() private method

private _interpretResponse ( string $httpBody, integer $httpStatus ) : mixed
$httpBody string
$httpStatus integer
return mixed
    private function _interpretResponse($httpBody, $httpStatus)
    {
        try {
            $response = json_decode($httpBody, true);
        } catch (\Exception $e) {
            throw new Error("Invalid response body from API: HTTP Status: ({$httpStatus}) {$httpBody}", $httpStatus, $httpBody);
        }
        if ($httpStatus < 200 || $httpStatus >= 300) {
            $this->handleApiError($httpBody, $httpStatus, $response);
        }
        return $response;
    }