1 | <?php |
||
10 | class Notifier { |
||
11 | protected $config; |
||
12 | protected $log; |
||
13 | protected $messageCb; |
||
14 | protected $subjectCb; |
||
15 | |||
16 | /** |
||
17 | * You can provide a Monolog Logger instance to use in the constructor |
||
18 | * @param Logger|null $log Logger instance to use |
||
19 | */ |
||
20 | 36 | public function __construct(Logger $log = null) { |
|
28 | |||
29 | /** |
||
30 | * Transforms a value into a closure that returns itself when called |
||
31 | * @param callable|string $cb The value that you want to wrap in a closure |
||
32 | * @return callable |
||
33 | */ |
||
34 | 9 | private function wrapValueInClosure($cb){ |
|
41 | |||
42 | /** |
||
43 | * Set a string or a closure to be called that will generate the message body for the notification |
||
44 | * @param callable|string $cb A closure or string that will be set for the message |
||
45 | */ |
||
46 | 6 | public function setMessage($cb) |
|
51 | |||
52 | /** |
||
53 | * Returns the result of the message closure |
||
54 | * @param Exception $e The Exception instance that you want to build the message around |
||
55 | * @return string The message string |
||
56 | */ |
||
57 | 9 | public function getMessage(Exception $e) { |
|
68 | |||
69 | /** |
||
70 | * Set a string or a closure to be called that will generate the subject line for the notification |
||
71 | * @param callable|string $cb A closure or string that will be set for the subject line |
||
72 | */ |
||
73 | 3 | public function setSubject($cb) |
|
78 | |||
79 | /** |
||
80 | * Returns the result of the subject closure |
||
81 | * @param Exception $e The Exception instance that you want to build the subject around |
||
82 | * @return string The subject string |
||
83 | */ |
||
84 | 6 | public function getSubject(Exception $e) { |
|
91 | |||
92 | /** |
||
93 | * Pushes on another Monolog Handler |
||
94 | * @param HandlerInterface $handler The handler instance to add on |
||
95 | * @return Notifier Returns this |
||
96 | */ |
||
97 | 3 | public function pushHandler(HandlerInterface $handler) { |
|
101 | |||
102 | /** |
||
103 | * Triggers the Monolog Logger instance to log an error to all handlers |
||
104 | * @param Exception $e The exception to use |
||
105 | * @return Notifier Returns this |
||
106 | */ |
||
107 | 3 | public function send(Exception $e) { |
|
123 | } |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.