public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $this->data[$this->flashParam] = $counters;
        if (empty($this->data[$key])) {
            $this->data[$key] = [$value];
        } else {
            if (is_array($this->data[$key])) {
                $this->data[$key][] = $value;
            } else {
                $this->data[$key] = [$this->data[$key], $value];
            }
        }
    }
public function addFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $this->data[$this->flashParam] = $counters;
        if (empty($this->data[$key])) {
            $this->data[$key] = [$value];
        } else {
            if (is_array($this->data[$key])) {
                $this->data[$key][] = $value;
            } else {
                $this->data[$key] = [$this->data[$key], $value];
            }
        }
    }
public function addFlash ( $ key , $ value = true , $ removeAfterAccess = true ) { $ counters = $ this -> get ( $ this -> flashParam , [ ] ) ; $ counters [ $ key ] = $ removeAfterAccess ? - 1 : 0 ; $ this -> data [ $ this -> flashParam ] = $ counters ; if ( empty ( $ this -> data [ $ key ] ) ) { $ this -> data [ $ key ] = [ $ value ] ; } else { if ( is_array ( $ this -> data [ $ key ] ) ) { $ this -> data [ $ key ] [ ] = $ value ; } else { $ this -> data [ $ key ] = [ $ this -> data [ $ key ] , $ value ] ; } } }
Adds a flash message.
If there are existing flash messages with the same key, the new one will be appended to the existing message array.
@param string $key the key identifying the flash message.
@param mixed $value flash message
@param bool $removeAfterAccess whether the flash message should be automatically removed only if
it is accessed. If false, the flash message will be automatically removed after the next request,
regardless if it is accessed or not. If true (default value), the flash message will remain until after
it is accessed.
@see getFlash()
@see setFlash()
@see removeFlash()
Adds a flash message . If there are existing flash messages with the same key the new one will be appended to the existing message array .