Properties

$additionalDetails

$additionalDetails : array

Additional details to include in report.

Type

array

$type

$type : string

URL describing the problem type; defaults to HTTP status codes.

Type

string

$detail

$detail : string|\Pivot\Core\Models\Exception|\Pivot\Core\Models\Throwable

Description of the specific problem.

Type

string|\Pivot\Core\Models\Exception|\Pivot\Core\Models\Throwable

$detailIncludesStackTrace

$detailIncludesStackTrace : boolean

Whether or not to include a stack trace and previous exceptions when an exception is provided for the detail.

Type

boolean

$status

$status : integer

HTTP status for the error.

Type

integer

$normalizedProperties

$normalizedProperties : array

Normalized property names for overloading.

Type

array

$problemStatusTitles

$problemStatusTitles : array

Status titles for common problems.

Type

array

$title

$title : string

Title of the error.

Type

string

Methods

__construct()

__construct(integer  $status, string|\Pivot\Core\Models\Exception|\Pivot\Core\Models\Throwable  $detail = '', string  $type = null, string  $title = null, array  $additional = array()) 

Constructor.

Create an instance using the provided information. If nothing is provided for the type field, the class default will be used; if the status matches any known, the title field will be selected from $problemStatusTitles as a result.

Parameters

integer $status
string|\Pivot\Core\Models\Exception|\Pivot\Core\Models\Throwable $detail
string $type
string $title
array $additional

__get()

__get(string  $name) : mixed

Retrieve properties.

Parameters

string $name

Throws

\Pivot\Core\Models\InvalidArgumentException

Returns

mixed

toArray()

toArray() : array

Cast to an array.

Returns

array

jsonSerialize()

jsonSerialize() : object

So we can controll the json output

Returns

object —

ApiProblem for Json

__toString()

__toString() 

setDetailIncludesStackTrace()

setDetailIncludesStackTrace(boolean  $flag) : \Pivot\Core\Models\ApiProblem

Set the flag indicating whether an exception detail should include a stack trace and previous exception information.

Parameters

boolean $flag

Returns

\Pivot\Core\Models\ApiProblem

getStatus()

getStatus() : string

Retrieve the API-Problem HTTP status code.

If an exception was provided, creates the status code from it; otherwise, code as provided is used.

Returns

string

getDetail()

getDetail() : string

Retrieve the API-Problem detail.

If an exception was provided, creates the detail message from it; otherwise, detail as provided is used.

Returns

string

getType()

getType() : string

Retrieve the API-Problem type.

Returns

string

getTitle()

getTitle() : string

Retrieve the title.

If the default $type is used, and the $status is found in $problemStatusTitles, then use the matching title.

If no title was provided, and the above conditions are not met, use the string 'Unknown'.

Otherwise, use the title provided.

Returns

string

createDetailFromException()

createDetailFromException() : string

Create detail message from an exception.

Returns

string

createStatusFromException()

createStatusFromException() : integer

Create HTTP status from an exception.

Returns

integer