Bogardo\Mailgun\Mail\Mailer::renderBody PHP Method

renderBody() protected method

When only a string is passed as the view we default to an HTML body. When an array without keys is passed as the view; the first value will be handled as the HTML body. An optional second value will be handled as the text body. When an array with keys (html, text or raw) is passed as the view; the values for those keys will be handled according to the key.
protected renderBody ( string | array $view, array $data )
$view string | array
$data array
    protected function renderBody($view, array $data)
    {
        $data['message'] = $this->message;
        if (is_string($view)) {
            $this->setHtmlBody($view, $data);
        }
        if (is_array($view) && isset($view[0])) {
            $this->setHtmlBody($view[0], $data);
            if (isset($view[1])) {
                $this->setTextBody($view[1], $data);
            }
        } elseif (is_array($view)) {
            if (isset($view['html'])) {
                $this->setHtmlBody($view['html'], $data);
            }
            if (isset($view['text'])) {
                $this->setTextBody($view['text'], $data);
            }
            if (isset($view['raw'])) {
                $this->setRawBody($view['raw']);
            }
        }
    }