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