PHP Class Tylercd100\LERN\Components\Notifier

Inheritance: extends Component
Datei anzeigen Open project: tylercd100/lern Class Usage Examples

Protected Properties

Property Type Description
$config
$contextCb
$log
$messageCb
$subjectCb

Public Methods

Method Description
__construct ( Logger $log = null ) You can provide a Monolog Logger instance to use in the constructor
getContext ( Exception $e, $context = [] ) : array Returns the result of the context closure
getMessage ( Exception $e ) : string Returns the result of the message closure
getMessageViaCallback ( Exception $e ) : String | false Gets the Exception message using a callback if it is set
getMessageViaDefault ( Exception $e ) : String Gets a basic Exception message
getMessageViaView ( Exception $e ) : String | false Gets the Exception message using a Laravel view file
getSubject ( Exception $e ) : string Returns the result of the subject closure
pushHandler ( Monolog\Handler\HandlerInterface $handler ) : Notifier Pushes on another Monolog Handler
send ( Exception $e, array $context = [] ) : boolean Triggers the Monolog Logger instance to log an error to all handlers
setContext ( callable | array $cb ) Set an array or a closure to be called that will generate the context array for the notification
setMessage ( callable | string $cb ) Set a string or a closure to be called that will generate the message body for the notification
setSubject ( callable | string $cb ) Set a string or a closure to be called that will generate the subject line for the notification

Private Methods

Method Description
wrapValueInClosure ( callable | string $cb ) : callable Transforms a value into a closure that returns itself when called

Method Details

__construct() public method

You can provide a Monolog Logger instance to use in the constructor
public __construct ( Logger $log = null )
$log Monolog\Logger Logger instance to use

getContext() public method

Returns the result of the context closure
public getContext ( Exception $e, $context = [] ) : array
$e Exception The Exception instance that you want to build the context around
return array The context array

getMessage() public method

Returns the result of the message closure
public getMessage ( Exception $e ) : string
$e Exception The Exception instance that you want to build the message around
return string The message string

getMessageViaCallback() public method

Gets the Exception message using a callback if it is set
public getMessageViaCallback ( Exception $e ) : String | false
$e Exception The Exception instance that you want to build the message around
return String | false Returns the message string or false

getMessageViaDefault() public method

Gets a basic Exception message
public getMessageViaDefault ( Exception $e ) : String
$e Exception The Exception instance that you want to build the message around
return String Returns the message string

getMessageViaView() public method

Gets the Exception message using a Laravel view file
public getMessageViaView ( Exception $e ) : String | false
$e Exception The Exception instance that you want to build the message around
return String | false Returns the message string or false

getSubject() public method

Returns the result of the subject closure
public getSubject ( Exception $e ) : string
$e Exception The Exception instance that you want to build the subject around
return string The subject string

pushHandler() public method

Pushes on another Monolog Handler
public pushHandler ( Monolog\Handler\HandlerInterface $handler ) : Notifier
$handler Monolog\Handler\HandlerInterface The handler instance to add on
return Notifier Returns this

send() public method

Triggers the Monolog Logger instance to log an error to all handlers
public send ( Exception $e, array $context = [] ) : boolean
$e Exception The exception to use
$context array Additional information that you would like to pass to Monolog
return boolean

setContext() public method

Set an array or a closure to be called that will generate the context array for the notification
public setContext ( callable | array $cb )
$cb callable | array A closure or array that will be set for the context

setMessage() public method

Set a string or a closure to be called that will generate the message body for the notification
public setMessage ( callable | string $cb )
$cb callable | string A closure or string that will be set for the message

setSubject() public method

Set a string or a closure to be called that will generate the subject line for the notification
public setSubject ( callable | string $cb )
$cb callable | string A closure or string that will be set for the subject line

Property Details

$config protected_oe property

protected $config

$contextCb protected_oe property

protected $contextCb

$log protected_oe property

protected $log

$messageCb protected_oe property

protected $messageCb

$subjectCb protected_oe property

protected $subjectCb