13 public function add($type,$message,$tags = null){
14 if($message = $tags ===
false ? $message : $this->
component(
'trans')->str($message,$tags)){
15 $messages = $this->session->messages ?: [];
16 $messages[$message] = $type;
17 $this->session->messages = $messages;
26 public function retrieve($type = null,$clear =
true){
27 $messages = $this->session->messages ?: [];
28 $result = $type ? array_filter($messages,
function($message_type) use ($type){
return $message_type == $type; }) : $messages;
29 if($clear) $this->session->messages = array_diff_key($messages,$result);
33 protected function _get($key){
37 protected function _set($key,$value){
38 $this->
add($key,$value);
41 public function __call($func_name,$params){
42 $this->
add($func_name,array_shift($params),array_shift($params));
45 public function __invoke($message,$tags = null){
46 $this->
add(
'message',$message,$tags);
__invoke($message, $tags=null)
add($type, $message, $tags=null)
Add a message to the session.
retrieve($type=null, $clear=true)
Retrieve messages.
component($name)
Get a component (local or default).
__call($func_name, $params)