1 | <?php namespace Anomaly\Streams\Platform\Message; |
||
13 | class MessageBag |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * The session store. |
||
18 | * |
||
19 | * @var Store |
||
20 | */ |
||
21 | protected $session; |
||
22 | |||
23 | /** |
||
24 | * Create a new MessageBag instance. |
||
25 | * |
||
26 | * @param Store $session |
||
27 | */ |
||
28 | public function __construct(Store $session) |
||
32 | |||
33 | /** |
||
34 | * Merge a message onto the session. |
||
35 | * |
||
36 | * @param $type |
||
37 | * @param $message |
||
38 | */ |
||
39 | protected function merge($type, $message) |
||
55 | |||
56 | /** |
||
57 | * Return whether messages exist. |
||
58 | * |
||
59 | * @param $type |
||
60 | * @return bool |
||
61 | */ |
||
62 | public function has($type) |
||
66 | |||
67 | /** |
||
68 | * Get messages. |
||
69 | * |
||
70 | * @param $type |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function get($type) |
||
77 | |||
78 | /** |
||
79 | * Pull the messages. |
||
80 | * |
||
81 | * @param $type |
||
82 | * @return array |
||
83 | */ |
||
84 | public function pull($type) |
||
88 | |||
89 | /** |
||
90 | * Add an error message. |
||
91 | * |
||
92 | * @param $message |
||
93 | * @return $this |
||
94 | */ |
||
95 | public function error($message) |
||
101 | |||
102 | /** |
||
103 | * Add an info message. |
||
104 | * |
||
105 | * @param $message |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function info($message) |
||
114 | |||
115 | /** |
||
116 | * Add a success message. |
||
117 | * |
||
118 | * @param $message |
||
119 | * @return $this |
||
120 | */ |
||
121 | public function success($message) |
||
127 | |||
128 | /** |
||
129 | * Add a warning message. |
||
130 | * |
||
131 | * @param $message |
||
132 | * @return $this |
||
133 | */ |
||
134 | public function warning($message) |
||
140 | |||
141 | /** |
||
142 | * Flush the messages. |
||
143 | * |
||
144 | * @return $this |
||
145 | */ |
||
146 | public function flush() |
||
155 | } |
||
156 |