Error
in package
Holds information about an error or notice that happened on a specific object.
Tags
Table of Contents
- $exception : Throwable|null
- $message : string
- $object : ErrorBag
- $psrLevel : string
- $levelMap : array<string|int, mixed>
- __construct() : mixed
- getClass() : string
- Returns the class type the error occurred on.
- getException() : Throwable|null
- Returns the exception that occurred, if any, or null.
- getMessage() : string
- Returns the error message.
- getObject() : ErrorBag
- Returns the object the error occurred on.
- getPsrLevel() : string
- Returns the PSR string log level for this error message.
- isPsrLevelGreaterOrEqualTo() : bool
- Returns true if the PSR log level for this error is equal to or greater than the one passed, e.g. passing LogLevel::ERROR would return true for LogLevel::ERROR and LogLevel::CRITICAL, ALERT and EMERGENCY.
Properties
$exception
protected
Throwable|null
$exception
An Exception object if one happened, or null if not
$message
protected
string
$message
The error message.
$object
protected
ErrorBag
$object
The object the error/notice occurred on.
$psrLevel
protected
string
$psrLevel
The PSR log level for this error.
$levelMap
private
array<string|int, mixed>
$levelMap
= [\Psr\Log\LogLevel::EMERGENCY => 0, \Psr\Log\LogLevel::ALERT => 1, \Psr\Log\LogLevel::CRITICAL => 2, \Psr\Log\LogLevel::ERROR => 3, \Psr\Log\LogLevel::WARNING => 4, \Psr\Log\LogLevel::NOTICE => 5, \Psr\Log\LogLevel::INFO => 6, \Psr\Log\LogLevel::DEBUG => 7]
Methods
__construct()
public
__construct(string $message, string $psrLogLevelAsErrorLevel, ErrorBag $object[, Throwable|null $exception = null ]) : mixed
Parameters
- $message : string
- $psrLogLevelAsErrorLevel : string
- $object : ErrorBag
- $exception : Throwable|null = null
Tags
Return values
mixed —getClass()
Returns the class type the error occurred on.
public
getClass() : string
Return values
string —getException()
Returns the exception that occurred, if any, or null.
public
getException() : Throwable|null
Return values
Throwable|null —getMessage()
Returns the error message.
public
getMessage() : string
Return values
string —getObject()
Returns the object the error occurred on.
public
getObject() : ErrorBag
Return values
ErrorBag —getPsrLevel()
Returns the PSR string log level for this error message.
public
getPsrLevel() : string
Return values
string —isPsrLevelGreaterOrEqualTo()
Returns true if the PSR log level for this error is equal to or greater than the one passed, e.g. passing LogLevel::ERROR would return true for LogLevel::ERROR and LogLevel::CRITICAL, ALERT and EMERGENCY.
public
isPsrLevelGreaterOrEqualTo(string $minLevel) : bool
Parameters
- $minLevel : string