| Conditions | 5 |
| Paths | 10 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | public function addMessage(string $message, ?array $options = []): void |
||
| 51 | { |
||
| 52 | $defaults = [ |
||
| 53 | 'type' => 'notice', |
||
| 54 | 'channel' => 'notification' |
||
| 55 | ]; |
||
| 56 | $options = array_merge($defaults, $options); |
||
| 57 | |||
| 58 | if (!is_array($message)) { |
||
| 59 | $message = [$message]; |
||
| 60 | } |
||
| 61 | |||
| 62 | foreach ($message as $m) { |
||
| 63 | $nm = [ |
||
| 64 | 'message' => $m, |
||
| 65 | 'type' => $options['type'], |
||
| 66 | 'channel' => $options['channel'] |
||
| 67 | ]; |
||
| 68 | if (isset($options['title'])) { |
||
| 69 | $nm['title'] = $options['title']; |
||
| 70 | } |
||
| 71 | if (isset($options['element'])) { |
||
| 72 | $nm['element'] = $options['element']; |
||
| 73 | } |
||
| 74 | $this->_appJs['msg'][] = $nm; |
||
| 75 | } |
||
| 76 | } |
||
| 77 | |||
| 88 |