protected function createMessageContent(Twig_Template $template, array $context): MessageContent
    {
        $mimeType = $this->renderBlock($template, 'content_type', $context);
        $content = $mimeType === 'text/html'
            ? new HtmlMessageContent
            : new GenericMessageContent($mimeType);

        $context['_content'] = $content;
        $content->modify(
            $this->renderBlock($template, 'content', $context),
            $this->renderBlock($template, 'text_content', $context) ?: null
        );

        $attachments = array_filter(preg_split('/\s*[,;]\s*/', trim($this->renderBlock($template, 'attachments', $context))));
        foreach ($attachments as $path) {
            $content->attach($path);
        }

        return $content;
    }
protected function createMessageContent(Twig_Template $template, array $context): MessageContent
    {
        $mimeType = $this->renderBlock($template, 'content_type', $context);
        $content = $mimeType === 'text/html'
            ? new HtmlMessageContent
            : new GenericMessageContent($mimeType);

        $context['_content'] = $content;
        $content->modify(
            $this->renderBlock($template, 'content', $context),
            $this->renderBlock($template, 'text_content', $context) ?: null
        );

        $attachments = array_filter(preg_split('/\s*[,;]\s*/', trim($this->renderBlock($template, 'attachments', $context))));
        foreach ($attachments as $path) {
            $content->attach($path);
        }

        return $content;
    }
protected function createMessageContent ( Twig_Template $ template , array $ context ) : MessageContent { $ mimeType = $ this -> renderBlock ( $ template , 'content_type' , $ context ) ; $ content = $ mimeType === 'text/html' ? new HtmlMessageContent : new GenericMessageContent ( $ mimeType ) ; $ context [ '_content' ] = $ content ; $ content -> modify ( $ this -> renderBlock ( $ template , 'content' , $ context ) , $ this -> renderBlock ( $ template , 'text_content' , $ context ) ? : null ) ; $ attachments = array_filter ( preg_split ( '/\s*[,;]\s*/' , trim ( $ this -> renderBlock ( $ template , 'attachments' , $ context ) ) ) ) ; foreach ( $ attachments as $ path ) { $ content -> attach ( $ path ) ; } return $ content ; }
Create a message content from the given template and context.

@param Twig_Template $template
@param mixed[] $context

@return MessageContent
Create a message content from the given template and context .