protected function addContentToMailerInternal($message, $template, $data, $plainOnly = false)
    {
        /*
         * Start twig transaction
         */
        $this->startTwig();

        /*
         * Inject global view variables
         */
        $globalVars = ViewHelper::getGlobalVars();
        if (!empty($globalVars)) {
            $data = (array) $data + $globalVars;
        }

        /*
         * Subject
         */
        $swiftMessage = $message->getSwiftMessage();

        if (empty($swiftMessage->getSubject())) {
            $message->subject(Twig::parse($template->subject, $data));
        }

        $data += [
            'subject' => $swiftMessage->getSubject()
        ];

        if (!$plainOnly) {
            /*
             * HTML contents
             */
            $html = $this->renderTemplate($template, $data);

            $message->setBody($html, 'text/html');
        }

        /*
         * Text contents
         */
        $text = $this->renderTextTemplate($template, $data);

        $message->addPart($text, 'text/plain');

        /*
         * End twig transaction
         */
        $this->stopTwig();
    }
protected function addContentToMailerInternal($message, $template, $data, $plainOnly = false)
    {
        /*
         * Start twig transaction
         */
        $this->startTwig();

        /*
         * Inject global view variables
         */
        $globalVars = ViewHelper::getGlobalVars();
        if (!empty($globalVars)) {
            $data = (array) $data + $globalVars;
        }

        /*
         * Subject
         */
        $swiftMessage = $message->getSwiftMessage();

        if (empty($swiftMessage->getSubject())) {
            $message->subject(Twig::parse($template->subject, $data));
        }

        $data += [
            'subject' => $swiftMessage->getSubject()
        ];

        if (!$plainOnly) {
            /*
             * HTML contents
             */
            $html = $this->renderTemplate($template, $data);

            $message->setBody($html, 'text/html');
        }

        /*
         * Text contents
         */
        $text = $this->renderTextTemplate($template, $data);

        $message->addPart($text, 'text/plain');

        /*
         * End twig transaction
         */
        $this->stopTwig();
    }
protected function addContentToMailerInternal ( $ message , $ template , $ data , $ plainOnly = false ) { /*
         * Start twig transaction
         */ $ this -> startTwig ( ) ; /*
         * Inject global view variables
         */ $ globalVars = ViewHelper :: getGlobalVars ( ) ; if ( ! empty ( $ globalVars ) ) { $ data = ( array ) $ data + $ globalVars ; } /*
         * Subject
         */ $ swiftMessage = $ message -> getSwiftMessage ( ) ; if ( empty ( $ swiftMessage -> getSubject ( ) ) ) { $ message -> subject ( Twig :: parse ( $ template -> subject , $ data ) ) ; } $ data += [ 'subject' => $ swiftMessage -> getSubject ( ) ] ; if ( ! $ plainOnly ) { /*
             * HTML contents
             */ $ html = $ this -> renderTemplate ( $ template , $ data ) ; $ message -> setBody ( $ html , 'text/html' ) ; } /*
         * Text contents
         */ $ text = $ this -> renderTextTemplate ( $ template , $ data ) ; $ message -> addPart ( $ text , 'text/plain' ) ; /*
         * End twig transaction
         */ $ this -> stopTwig ( ) ; }
Internal method used to share logic between `addRawContentToMailer` and `addContentToMailer`

@param \Illuminate\Mail\Message $message
@param string $template
@param array $data
@param bool $plainOnly Add only plain text content to the message
@return void
Internal method used to share logic between addRawContentToMailer and addContentToMailer