public function has($type = null)
    {
        if ($type === null) {
            return !empty($this->session[$this->prefix]);
        }

        foreach ($this->session[$this->prefix] as $message) {
            if ($message['type'] === $type) {
                return true;
            }
        }

        return false;
    }