1 | <?php |
||
9 | class Message |
||
10 | { |
||
11 | |||
12 | private $message; |
||
13 | private $type = self::TYPE_DEFAULT; |
||
14 | |||
15 | const TYPE_DEFAULT = 'default'; |
||
16 | const TYPE_SUCCESS = 'success'; |
||
17 | const TYPE_INFO = 'info'; |
||
18 | const TYPE_WARNING = 'warning'; |
||
19 | const TYPE_DANGER = 'danger'; |
||
20 | |||
21 | /** |
||
22 | * Construct a new flash message |
||
23 | * @param string $message |
||
24 | * @param string $type |
||
25 | */ |
||
26 | 3 | public function __construct($message, $type = self::TYPE_DEFAULT) |
|
30 | |||
31 | /** |
||
32 | * Set message property |
||
33 | * @param string $message |
||
34 | * @return $this |
||
35 | */ |
||
36 | 3 | public function setMessage($message) |
|
41 | |||
42 | /** |
||
43 | * Set type property |
||
44 | * @param string $type |
||
45 | * @return $this |
||
46 | */ |
||
47 | 3 | public function setType($type) |
|
52 | |||
53 | /** |
||
54 | * Get message property |
||
55 | * @return string $message |
||
56 | */ |
||
57 | 1 | public function getMessage() |
|
61 | |||
62 | /** |
||
63 | * Get message property |
||
64 | * @return string|null $type |
||
65 | */ |
||
66 | 1 | public function getType() |
|
70 | |||
71 | /** |
||
72 | * Checks if the type given is valid |
||
73 | * @param string $type |
||
74 | * @return string |
||
75 | */ |
||
76 | 3 | private function checkType($type) |
|
89 | } |
||
90 |