Krucas\Notification\NotificationsBag::addInstance PHP Method

addInstance() protected method

Add message by instance.
protected addInstance ( Krucas\Notification\Message $message, string $type, boolean $flash = true, null $format = null )
$message Krucas\Notification\Message
$type string
$flash boolean
$format null
    protected function addInstance(Message $message, $type, $flash = true, $format = null)
    {
        $message->setType($type);
        if ($message->isFlash() != $flash) {
            $message->setFlash($flash);
        }
        if (is_null($message->getFormat())) {
            $message->setFormat($this->getFormat($type));
        }
        if (!is_null($format)) {
            $message->setFormat($this->checkFormat($format, $type));
        }
    }