src/Web/Sessions/Session.php
public function setFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $this->data[$key] = $value;
        $this->data[$this->flashParam] = $counters;
    }
public function setFlash($key, $value = true, $removeAfterAccess = true)
    {
        $counters = $this->get($this->flashParam, []);
        $counters[$key] = $removeAfterAccess ? -1 : 0;
        $this->data[$key] = $value;
        $this->data[$this->flashParam] = $counters;
    }
Sets a flash message.
A flash message will be automatically deleted after it is accessed in a request and the deletion will happen
in the next request.
If there is already an existing flash message with the same key, it will be overwritten by the new one.
@param string $key the key identifying the flash message. Note that flash messages
and normal session variables share the same name space. If you have a normal
session variable using the same name, its value will be overwritten by this method.
@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 addFlash()
@see removeFlash()