1 | <?php |
||
13 | class LERN |
||
14 | { |
||
15 | |||
16 | private $exception; |
||
17 | private $notifier; |
||
18 | |||
19 | /** |
||
20 | * @param Notifier|null $notifier Notifier instance |
||
21 | */ |
||
22 | 9 | public function __construct(Notifier $notifier = null) |
|
29 | |||
30 | /** |
||
31 | * Will execute record and notify methods |
||
32 | * @param Exception $e The exception to use |
||
33 | * @return ExceptionModel the recorded Eloquent Model |
||
34 | */ |
||
35 | 3 | public function handle(Exception $e) |
|
41 | |||
42 | /** |
||
43 | * Stores the exception in the database |
||
44 | * @param Exception $e The exception to use |
||
45 | * @return ExceptionModel the recorded Eloquent Model |
||
46 | */ |
||
47 | 3 | public function record(Exception $e) |
|
65 | |||
66 | /** |
||
67 | * Will send the exception to all monolog handlers |
||
68 | * @param Exception $e The exception to use |
||
69 | * @return void |
||
70 | */ |
||
71 | 3 | public function notify(Exception $e) |
|
76 | |||
77 | /** |
||
78 | * Pushes on another Monolog Handler |
||
79 | * @param HandlerInterface $handler The handler instance to add on |
||
80 | * @return Notifier Returns this |
||
81 | */ |
||
82 | public function pushHandler(HandlerInterface $handler) { |
||
86 | |||
87 | /** |
||
88 | * Get Notifier |
||
89 | * @return Notifier |
||
90 | */ |
||
91 | public function getNotifier() |
||
95 | |||
96 | /** |
||
97 | * Set Notifier |
||
98 | * @param Notifier $notifier A Notifier instance to use |
||
99 | */ |
||
100 | public function setNotifier(Notifier $notifier) |
||
105 | |||
106 | /** |
||
107 | * Set a string or a closure to be called that will generate the message body for the notification |
||
108 | * @param function|string $cb This closure function will be passed an Exception and must return a string |
||
109 | */ |
||
110 | public function setMessage($cb) |
||
115 | |||
116 | /** |
||
117 | * Set a string or a closure to be called that will generate the subject line for the notification |
||
118 | * @param function|string $cb This closure function will be passed an Exception and must return a string |
||
119 | */ |
||
120 | public function setSubject($cb) |
||
125 | |||
126 | } |