Add a message to the notifier

@param $content
@param string $level
@param int $timeout
@param int $priority
@param bool $dismissable
@param string $area
@return $this
164645
public function add($content, $level = '', $timeout = 0, $priority = 0, $dismissable = true, $area = '')
    {
        $area = $area ?: is_array($content) && isset($content['area']) ? $content['area'] : $this->workingArea ?: $this->defaultArea;
        $level = $level ?: $this->defaultLevel;

        if (!$this->canView($area)) {
            return $this;
        }

        $content = is_array($content) ? $content : [
            'content'     => $content,
            'level'       => $level,
            'timeout'     => $timeout,
            'priority'    => $priority,
            'dismissable' => $dismissable,
        ];

        if($this->blocker()->isBlocked($content)) {
            return;
        }

        $this->style($area);

        $messages = (array)Session::get($this->id . '.' . $area);

        if($dismissable && !isset($content['dismiss_link'])) {
            $content['dismiss_link'] = singleton('Milkyway\SS\FlashMessage\Controller')->Link('dismiss' . '?' . http_build_query([
                    'area' => $area,
                    'id' => empty($content['id']) ? '' : $content['id'],
                    'content' => empty($content['content']) ? '' : $content['content'],
                ]));
        }

        array_unshift($messages, $content);

        Session::set($this->id . '.' . $area, $messages);

        $this->clearWorking();

        return $this;
    }
601843
public function alert(String $type, $content)
    {
        $content = $this->stringOrCallback($content);

        $this->isBootstrapAttribute('dismiss-fade', function() use(&$type)
        {
            $type .= ' alert-dismissible fade show';
        });

        $this->isBootstrapAttribute('dismiss-button', function($attribute) use(&$content)
        {
            $content .= $this->buttonDismissButton($this->spanDismissButton($attribute));  
        });

        return $this->role('alert')->class('alert alert-' . $type)->div($content);
    }
1185257
public function warning($message, array $placeholders = [], $dismissible = true)
    {
        $this->message($message, null, $placeholders, 'warning', $dismissible);

        return $this;
    }
339904
public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text)
    {
        //lastWrittenPercent and lastWrittenTime are used to prevent performance issues if
        //many progresses are written. (the filesystem access at nfs can slow that down)
        //we just update the progressbar if the percentage increases and
        //the last request was at least 500ms ago
        if (!$this->_lastWrittenPercent) {
            $this->_lastWrittenPercent = (int)($percent*100);
        }
        if (!$this->_lastWrittenTime) {
            $this->_lastWrittenTime = microtime(true);
        }
        if ($this->_lastWrittenPercent < (int)($percent*100)
            && $this->_lastWrittenTime+0.5 <= microtime(true)) {
            $arguments = array(
                'current'       => $current,
                'max'           => $max,
                'percent'       => ($percent * 100),
                'timeTaken'     => $timeTaken,
                'timeRemaining' => $timeRemaining,
                'text'          => $text,
                'finished'      => false
            );
            $this->_saveStatus($arguments);
            $this->_lastWrittenPercent = (int)($percent*100);
            $this->_lastWrittenTime = microtime(true);
        }
    }
1164112
public function setNotification($prefix, $title, $message, $params, int $timeout, $group)
    {

        $toast = [
            "title" => $this->getTranslations($title, $params),
            "message" => $this->getTranslations($message, $params),
            "params" => ["prefix" => $prefix, "duration" => "".$timeout],
        ];


        $this->updateValue($group, 'notification', Builder::getArray($toast, true));

    }
917245
private function message(
        $message,
        $title = '',
        array $placeholders = [],
        $level = 'info',
        $dismissible = true,
        $overlay = false
    ) {
        $message = $this->getTranslation($message, $placeholders);

        if ( ! empty($title)) {
            $title = $this->getTranslation($title, $placeholders);
        }

        $flash = [
            'message'     => $message,
            'title'       => $title,
            'level'       => $level,
            'dismissible' => $dismissible,
            'overlay'     => $overlay,
            'class'       => $this->classNames[$level]
        ];

        $messages = $this->getExistingFlashMessages();
        $messages[] = $flash;

        $this->session->flash($this->sessionKey, $messages);

        return $this;
    }
1313564
public function handle(NotificationInterface $notification, $level)
    {
        if ($notification instanceof AttributeAwareInterface)
        {
            $options = $notification->attributes();
        }
        else
        {
            $options = [];
        }

        if ($notification instanceof TitleAwareInterface)
        {
            $options['header'] = $notification->title();
        }

        $variable = [
            'message' => $notification->message(),
            'type'    => isset($this->levelMapping[$level]) ? $this->levelMapping[$level] : self::STANDARD,
            'options' => $options
        ];

        $current = $this->smarty->getTemplateVars($this->var);

        if (!$current)
        {
            $this->smarty->assign($this->var, [$variable]);
        }
        else
        {
            $this->smarty->append($this->var, $variable);
        }

        return true;
    }
141788
protected function make($message, $title, $dismissable, $type)
    {
        if (! $this->isValidType($type)) {
            return false;
        }

        if (is_null($title) && $this->config('withTitles') === true) {
            $title = $this->getTitle($type);
        }

        $message = str_replace(
            '{counter}',
            count(@$_SESSION[$this->alias][$type]) + 1,
            $message
        );

        $this->addMessageToSession($message, $title, $dismissable, $type);

        return $this;
    }
798831
private function toConsole($time, $level, $message, $context) {

        $color = static::$colors[$level];

        $pattern = "<%s>%s</%s>";

        $message = sprintf($pattern, $color, $message, $color);

        $this->outputcontroller->out($message);

        if ( !empty($context) && $this->include_context ) {

            $this->outputcontroller->out(sprintf($pattern, $color, var_export($context, true), $color));

        }

    }
551268
public function contentAlternative($content, $contentType = null, $charset = null)
    {
        $this->getSwiftMessage()->addPart($content, $contentType, $charset);

        return $this;
    }
372430
public static function alert(String $message, String $time = NULL)
	{
		return self::report(__FUNCTION__, $message, NULL, $time);
	}
727630
public function writer($level, $message)
    {
        (!empty($this->file)) ? $fileName = $this->file : $fileName = '.logs';
        $fileHandling = new FileHandling();
        $text = 'Date/time: '.date('Y-m-d h:i:s A')." , Level: $level , message: ".$message."\n";
        $file = route()->storage->log.$fileName;
        $fileHandling->open($file, 'readWriteAppend')->write($text);
        $fileHandling->close();
    }
9210
public static function h(
        string $content, 
        int $level = 1, 
        $attributes = []
    ) : string
    {
        return self::tag("h".$level, $content, $attributes);
    }
994054
public function addPublishMessage(FormActionEvent $event)
    {
        if (!$this->isAdminSiteAccess($this->requestStack->getCurrentRequest())) {
            return;
        }
        $this->notificationHandler->success(
            $this->translator->trans(
                /** @Desc("Content published.") */
                'content.published.success',
                [],
                'content_edit'
            )
        );
    }
1000343
public function sendMessage($level, $message)
    {
        $mail = new Message($this->from);

        $mail->setTo($this->to);
        $mail->setText(ucfirst($level).': '.$message, $this->type);

        /** @var ITransport $transport */
        $transport = (new TransportInjector)->build();
        $transport->send($mail);
    }
628941
private function formatMessage($level, $message, $context)
    {
        $level = strtoupper($level);
        if (!empty($context)) {
            $message .= PHP_EOL . $this->indent($this->contextToString($context));
        }
        return "[{$this->getTimestamp()}] [{$level}] {$message}" . PHP_EOL;
    }
102105
protected function initMessage($level, $message, array $context)
    {
        // assert that message is a string, and interpolate placeholders
        $message = (string) $message;
        $context = $this->initContext($context);
        $message = self::interpolate($message, $context);

        // create message object
        $messageObj = new Message();
        $messageObj->setLevel($level);
        $messageObj->setShortMessage($message);
        $messageObj->setFacility($this->facility);

        foreach ($this->getDefaultContext() as $key => $value) {
            $messageObj->setAdditional($key, $value);
        }
        foreach ($context as $key => $value) {
            $messageObj->setAdditional($key, $value);
        }

        return $messageObj;
    }