a generic message method for Message helper.
use success, alert, and error methods.

@param string $type
@param string $message
@return ViewData
517475
public function setMessage($type, $message)
    {
        if (!is_null($message)) {
            $this->messages[] = [
                'message' => $message,
                'type'    => $type,
            ];
        }

        return $this;
    }
642177
public function setFlash(string $message, string $type = 'info')
    {
        return $this
            ->set('page', 'flash', 'message', $message)
            ->set('page', 'flash', 'type', $type);
    }
832250
public function notice($message, $type = null)
  {
    $type = is_null($type)
      ? 'info'
      : (is_bool($type)
        ? ($type
          ? 'success'
          : 'error')
        : $type);

    $this->getSession()->getFlashBag()->add($type, $message);

    return $this;
  }
1150850
public function log($message, $type = null)
	{
		$this->log[] = array('message' => $message, 'type' => $type);

		if (!$this->ignoreCallbacks && isset($this->callbacks['message']) && is_callable($this->callbacks['message']))
		{
			$this->callbacks['message']($message, $type);
		}
	}
1278533
public function addMessage($message, $type)
    {
        if (!is_string($message)) {
            throw new \InvalidArgumentException('Message must be a string');
        }
        if (!$message) {
            throw new \InvalidArgumentException('Message can\'t be empty');
        }
        if (!is_string($type)) {
            throw new \InvalidArgumentException('Type must be a string');
        }
        if (!$type) {
            throw new \InvalidArgumentException('Type can\'t be empty');
        }
        $this->messages[$type][] = $message;

        return $this;
    }
406966
public function add($message, $type = 'error')
    {
        $this->session[$this->prefix][] = ['message' => $message, 'type' => $type];

        return $this;
    }
542009
public function flashMessage($message, $type = 'default', $comment=null, $icon=null, $width=50, $iconSize="lg", $timeout=5)
    {
        $id = $this->getParameterId('flash');
        $presenter = $this->getPresenter();
        if($presenter instanceof Presenter){
            $messages = $presenter->getFlashSession()->$id;
        } else {
            $messages = null;
        }

        $messages[] = $flash = (object) [
             'title' => $message,
             'type' => $type,
             'comment' => $comment,
             'icon' => $icon,
             'width' => $width,
             'iconSize' =>$iconSize,
             'timeout' => $timeout
         ];
        $this->getTemplate()->flashes = $messages;
        if($presenter instanceof Presenter){
            $presenter->getFlashSession()->$id = $messages;
        }
        return $flash;
    }
964422
private function coreAddLog($type, $message)
    {
        //====================================================================//
        // Safety Check
        if (is_null($message)) {
            return;
        }
        //====================================================================//
        // Initialise buffer if unset
        if (!isset($this->{$type})) {
            $this->{$type} = array();
        }
        //====================================================================//
        // Build Prefix
        $prefix = empty($this->prefix) ? '' : '['.$this->prefix.'] ';
        //====================================================================//
        // Add text message to buffer
        array_push($this->{$type}, $prefix.$message);
    }
246578
private function add ($message, $type = Notification::ERROR, $isRaw = false, $canHide = true)
		{
			$this->_data[] = new Notification ($message, $type, $isRaw, $canHide);
		}
317560
public function getMessage($type = null, $key = 'messages')
    {
        if (isset($type)) {
            $key .= ".$type";
        }

        $message = $this->get($key, array());
        $this->delete($key);
        return $message;
    }
310974
function show_message($message, $type = 'notice', $vars = null, $override = true, $timeout = 0)
    {
        if ($this->app->text_exists($message)) {
            $message = $this->app->gettext(array('name' => $message, 'vars' => $vars));
        }

        printf("[%s] %s\n", strtoupper($type), $message);
    }
253722
public function log($message, $type = self::MESSAGE_INFO) {
        $format = [$type == self::MESSAGE_ERROR ? Console::FG_RED : Console::FG_BLUE];
        Console::stdout(Console::ansiFormat($message . PHP_EOL, $format));
    }
473810
public function message($message, $type = 'error', $redirect = null, $resultType = null)
    {
        $request = Yii::$app->getRequest();
        if ($resultType === null) {
            $resultType = $request->getIsAjax() ? 'json' : 'html';
        } elseif ($resultType === 'flash') {
            $resultType = Yii::$app->getRequest()->getIsAjax() ? 'json' : $resultType;
        }
        $data = [
            'type' => $type,
            'message' => $message,
            'redirect' => $redirect === null ? null : Url::to($redirect)
        ];
        switch ($resultType) {
            case 'html':
                return $this->render(Yii::$app->getModule('wechat')->messageLayout, $data);
            case 'json':
                Yii::$app->getResponse()->format = Response::FORMAT_JSON;
                return $data;
            case 'flash':
                Yii::$app->session->setFlash($type, $message);
                $data['redirect'] == null && $data['redirect'] = $request->getReferrer();
                Yii::$app->end(0, $this->redirect($data['redirect']));
                return true;
            default:
                return $message;
        }
    }
493214
public function _message($type, $message)
    {
        $cssClasses = isset($this->_cssClasses[$type]) ? $this->_cssClasses[$type] : '';

        $defaultMessages = [];
        $messages = $this->session->get($this->_sessionKey, $defaultMessages);
        $messages[] = '<div class="' . $cssClasses . '">' . $message . '</div>' . PHP_EOL;
        $this->session->set($this->_sessionKey, $messages);
    }
1146412
public function outputCli( $message, $type )
    {
        if ( $type == 'normal' )
        {
            $this->output->outputLine( $message );
            $this->output->outputLine();
        }
        else if ( $type == 'warning' )
        {
            $this->output->outputLine( "Warning: ", 'warning' );
            $this->output->outputLine( $message);
            $this->output->outputLine();
        }
    }
606076
public function add(string $type, string $message): FlashBag
    {
        if (is_string($type) && is_string($message)) {
            $this->messages[$type][] = $message;

            // Save into session
            $this->saveToSession();
        } else {
            trigger_error('FlashBag::add() accept only string parameters', E_USER_ERROR);
        }

        return $this;
    }
948615
public function assertContainsOnly($type, $isNativeType = null, $message = '')
    {
        Assert::assertContainsOnly($type, $this->getData(), $isNativeType, $message);

        return $this;
    }