| Total Complexity | 7 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class Notification |
||
| 15 | { |
||
| 16 | protected static ?INotify $storage = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param INotify $storage |
||
| 20 | */ |
||
| 21 | 1 | public static function init(INotify $storage): void |
|
| 22 | { |
||
| 23 | 1 | static::$storage = $storage; |
|
| 24 | 1 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @param string $message |
||
| 28 | * @throws NotifyException |
||
| 29 | */ |
||
| 30 | 2 | public static function addInfo(string $message): void |
|
| 31 | { |
||
| 32 | 2 | static::getNotify()->add(INotify::TARGET_INFO, $message); |
|
| 33 | 1 | } |
|
| 34 | |||
| 35 | /** |
||
| 36 | * @param string $message |
||
| 37 | * @throws NotifyException |
||
| 38 | */ |
||
| 39 | 1 | public static function addError(string $message): void |
|
| 40 | { |
||
| 41 | 1 | static::getNotify()->add(INotify::TARGET_ERROR, $message); |
|
| 42 | 1 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $message |
||
| 46 | * @throws NotifyException |
||
| 47 | */ |
||
| 48 | 1 | public static function addWarning(string $message): void |
|
| 49 | { |
||
| 50 | 1 | static::getNotify()->add(INotify::TARGET_WARNING, $message); |
|
| 51 | 1 | } |
|
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $message |
||
| 55 | * @throws NotifyException |
||
| 56 | */ |
||
| 57 | 1 | public static function addSuccess(string $message): void |
|
| 60 | 1 | } |
|
| 61 | |||
| 62 | /** |
||
| 63 | * @throws NotifyException |
||
| 64 | * @return INotify |
||
| 65 | */ |
||
| 66 | 2 | public static function getNotify(): INotify |
|
| 72 | } |
||
| 73 | } |
||
| 74 |