public function hasMessages($type = null)
    {
        if ( ! is_null($type)) {
            return ! empty($_SESSION[$this->key][$type]);
        }
        
        foreach ($this->types as $type) {
            if ( ! empty($_SESSION[$this->key][$type])) {
                return true;
            }
        }

        return false;
    }