protected function addFlashMessage($messageBody, $messageTitle = '', $severity = AbstractMessage::OK, $storeInSession = true)
    {
        if (PHP_SAPI === 'cli') {
            return;
        }
        if (!is_string($messageBody)) {
            throw new \InvalidArgumentException('The message body must be of type string, "' . gettype($messageBody) . '" given.', 1418250286);
        }
        $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $messageBody, $messageTitle, $severity, $storeInSession);
        $queue = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageQueue::class, self::EM_FLASH_MESSAGE_QUEUE_ID);
        $queue->enqueue($flashMessage);
    }
protected function addFlashMessage($messageBody, $messageTitle = '', $severity = AbstractMessage::OK, $storeInSession = true)
    {
        if (PHP_SAPI === 'cli') {
            return;
        }
        if (!is_string($messageBody)) {
            throw new \InvalidArgumentException('The message body must be of type string, "' . gettype($messageBody) . '" given.', 1418250286);
        }
        $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $messageBody, $messageTitle, $severity, $storeInSession);
        $queue = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageQueue::class, self::EM_FLASH_MESSAGE_QUEUE_ID);
        $queue->enqueue($flashMessage);
    }
protected function addFlashMessage ( $ messageBody , $ messageTitle = '' , $ severity = AbstractMessage :: OK , $ storeInSession = true ) { if ( PHP_SAPI === 'cli' ) { return ; } if ( ! is_string ( $ messageBody ) ) { throw new \ InvalidArgumentException ( 'The message body must be of type string, "' . gettype ( $ messageBody ) . '" given.' , 1418250286 ) ; } $ flashMessage = GeneralUtility :: makeInstance ( \ TYPO3 \ CMS \ Core \ Messaging \ FlashMessage :: class , $ messageBody , $ messageTitle , $ severity , $ storeInSession ) ; $ queue = GeneralUtility :: makeInstance ( \ TYPO3 \ CMS \ Core \ Messaging \ FlashMessageQueue :: class , self :: EM_FLASH_MESSAGE_QUEUE_ID ) ; $ queue -> enqueue ( $ flashMessage ) ; }
Creates a Message object and adds it to the FlashMessageQueue.

@param string $messageBody The message
@param string $messageTitle Optional message title
@param int $severity Optional severity, must be one of \TYPO3\CMS\Core\Messaging\FlashMessage constants
@param bool $storeInSession Optional, defines whether the message should be stored in the session (default) or not
@throws \TYPO3\CMS\Core\Exception
@throws \InvalidArgumentException if the message body is no string
@return void
Creates a Message object and adds it to the FlashMessageQueue .