| 1 | <?php |
||
| 19 | final class Message implements \JsonSerializable |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $message; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var string |
||
| 28 | */ |
||
| 29 | private $severity; |
||
| 30 | |||
| 31 | public const SEVERITY_LOW = 'low'; |
||
| 32 | public const SEVERITY_MEDIUM = 'medium'; |
||
| 33 | public const SEVERITY_HIGH = 'high'; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Message constructor. |
||
| 37 | * |
||
| 38 | * @param string $message |
||
| 39 | * @param string $severity |
||
| 40 | */ |
||
| 41 | private function __construct(string $message, string $severity) |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $message |
||
| 49 | * |
||
| 50 | * @return Message |
||
| 51 | */ |
||
| 52 | public static function low(string $message): Message |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param string $message |
||
| 59 | * |
||
| 60 | * @return Message |
||
| 61 | */ |
||
| 62 | public static function medium(string $message): Message |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param string $message |
||
| 69 | * |
||
| 70 | * @return Message |
||
| 71 | */ |
||
| 72 | public static function high(string $message): Message |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @return string |
||
| 79 | */ |
||
| 80 | public function getMessage(): string |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @return string |
||
| 87 | */ |
||
| 88 | public function getSeverity(): string |
||
| 92 | |||
| 93 | /** |
||
| 94 | * {@inheritdoc} |
||
| 95 | */ |
||
| 96 | public function jsonSerialize() |
||
| 103 | } |
||
| 104 |