src/Web/Sessions/Session.php
public function getFlash($key, $defaultValue = null, $delete = false)
    {
        $counters = $this->get($this->flashParam, []);
        if (isset($counters[$key])) {
            $value = $this->get($key, $defaultValue);
            if ($delete) {
                $this->removeFlash($key);
            } elseif ($counters[$key] < 0) {
                // mark for deletion in the next request
                $counters[$key] = 1;
                $this->data[$this->flashParam] = $counters;
            }

            return $value;
        }

        return $defaultValue;
    }
public function getFlash($key, $defaultValue = null, $delete = false)
    {
        $counters = $this->get($this->flashParam, []);
        if (isset($counters[$key])) {
            $value = $this->get($key, $defaultValue);
            if ($delete) {
                $this->removeFlash($key);
            } elseif ($counters[$key] < 0) {
                // mark for deletion in the next request
                $counters[$key] = 1;
                $this->data[$this->flashParam] = $counters;
            }

            return $value;
        }

        return $defaultValue;
    }
Returns a flash message.
@param string $key the key identifying the flash message
@param mixed $defaultValue value to be returned if the flash message does not exist.
@param bool $delete whether to delete this flash message right after this method is called.
If false, the flash message will be automatically deleted in the next request.
@return mixed the flash message or an array of messages if addFlash was used
@see setFlash()
@see addFlash()
@see hasFlash()
@see getAllFlashes()
@see removeFlash()