public function display($types = null, $return = false)
    {
        $html  = null;
        $types = $types ?: array_keys($this->config('types'));

        foreach ((array)$types as $type) {
            if (! $this->isValidType($type) || ($messages = $this->getMessages($type)) === null) {
                continue;
            }

            foreach ($messages as $message) {
                $html .= $this->formatMessage($message, $type);
            }

            $this->clear($type);
        }

        $html = sprintf($this->config('container'), $html);

        if ($return) {
            return $html;
        }

        echo $html;
    }