Total Complexity | 6 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class Toast |
||
10 | { |
||
11 | public function danger(string $message, string $title = null): Notification |
||
12 | { |
||
13 | return new Notification($message, $title, NotificationType::$danger); |
||
14 | } |
||
15 | |||
16 | public function debug(mixed $message, string $title = null): Notification |
||
17 | { |
||
18 | if (! is_string($message)) { |
||
19 | $message = json_encode($message, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT); |
||
20 | } |
||
21 | |||
22 | return new Notification($message, $title, NotificationType::$debug); |
||
23 | } |
||
24 | |||
25 | public function info(string $message, string $title = null): Notification |
||
26 | { |
||
27 | return new Notification($message, $title, NotificationType::$info); |
||
28 | } |
||
29 | |||
30 | public function success(string $message, string $title = null): Notification |
||
31 | { |
||
32 | return new Notification($message, $title, NotificationType::$success); |
||
33 | } |
||
34 | |||
35 | public function warning(string $message, string $title = null): Notification |
||
38 | } |
||
39 | } |
||
40 |