Conditions | 5 |
Paths | 10 |
Total Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function add(string $message, ?array $options = []): void |
||
27 | { |
||
28 | $defaults = [ |
||
29 | 'type' => 'notice', |
||
30 | 'channel' => 'notification' |
||
31 | ]; |
||
32 | $options = array_merge($defaults, $options); |
||
33 | |||
34 | if (!is_array($message)) { |
||
35 | $message = [$message]; |
||
36 | } |
||
37 | |||
38 | foreach ($message as $m) { |
||
39 | $nm = [ |
||
40 | 'message' => $m, |
||
41 | 'type' => $options['type'], |
||
42 | 'channel' => $options['channel'] |
||
43 | ]; |
||
44 | if (isset($options['title'])) { |
||
45 | $nm['title'] = $options['title']; |
||
46 | } |
||
47 | if (isset($options['element'])) { |
||
48 | $nm['element'] = $options['element']; |
||
49 | } |
||
50 | $this->notifications[] = $nm; |
||
51 | } |
||
52 | } |
||
53 | |||
64 |