Build raw envelope.

@return string
4602
private function _buildRaw()
    {
        $boundary = md5(uniqid(rand(), true));
        $raw_message = 'From: ' . $this->_encodeHeader($this->_source) . "\n";
        if (!empty($this->_to)) {
            $raw_message .= 'To: ' . $this->_encodeHeader($this->_to) . "\n";
        }
        if (!empty($this->_cc)) {
            $raw_message .= 'cc: ' . $this->_encodeHeader($this->_cc) . "\n";
        }
        if (!empty($this->_bcc)) {
            $raw_message .= 'Bcc: ' . $this->_encodeHeader($this->_cc) . "\n";
        }
        if (!empty($this->_replyTo)) {
            $raw_message .= 'Reply-To: ' . $this->_encodeHeader($this->_replyTo) . "\n";
        }

        $raw_message .= 'Subject: =?' . $this->_charset . '?B?' . base64_encode($this->_subject) . "?=\n";
        $raw_message .= 'MIME-Version: 1.0' . "\n";

        $raw_message .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . "\n"; 
        $raw_message .= "\n--{$boundary}\n";
        $raw_message .= 'Content-Type: multipart/alternative; boundary="alt-' . $boundary . '"' . "\n";

        if (strlen($this->_body) > 0) {
            $raw_message .= "\n--alt-{$boundary}\n";
            $raw_message .= 'Content-Type: text/plain; charset="' . $this->_charset . '"' . "\n\n";
            $raw_message .= $this->_body . "\n";
        }

        if (strlen($this->_htmlBody) > 0) {
            $raw_message .= "\n--alt-{$boundary}\n";
            $raw_message .= 'Content-Type: text/html; charset="' . $this->_charset . '"' . "\n\n";
            $raw_message .= $this->_htmlBody . "\n";
        }
        $raw_message .= "\n--alt-{$boundary}--\n";

        foreach ($this->_attachments as $attachment) {
            $raw_message .= "\n--{$boundary}\n";
            $raw_message .= 'Content-Type: ' . $attachment['mimeType'] . '; name="' . $attachment['name'] . '"' . "\n";
            if (!empty($attachment['contentId'])) {
                $raw_message .= 'Content-ID' . $attachment['contentId'] . "\n";
            }
            $raw_message .= 'Content-Transfer-Encoding: base64' . "\n";
            $raw_message .= "\n" . chunk_split(base64_encode($attachment['data']), 76, "\n") . "\n";
        }

        $raw_message .= "\n--{$boundary}--\n";

        return base64_encode($raw_message);
    }
726482
public function buildVCard()
    {
        // init string
        $string = "BEGIN:VCARD\r\n";
        $string .= "VERSION:3.0\r\n";
        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";

        // loop all properties
        $properties = $this->getProperties();
        foreach ($properties as $property) {
            // add to string
            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
        }

        // add to string
        $string .= "END:VCARD\r\n";

        // return
        return $string;
    }
589375
public function CreateHeader() {
    $result = '';

    // Set the boundaries
    $uniq_id = md5(uniqid(time()));
    $this->boundary[1] = 'b1_' . $uniq_id;
    $this->boundary[2] = 'b2_' . $uniq_id;

    $result .= $this->HeaderLine('Date', self::RFCDate());
    if($this->Sender == '') {
      $result .= $this->HeaderLine('Return-Path', trim($this->From));
    } else {
      $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
    }

    // To be created automatically by mail()
    if($this->Mailer != 'mail') {
      if(count($this->to) > 0) {
        $result .= $this->AddrAppend('To', $this->to);
      } elseif (count($this->cc) == 0) {
        $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
      }
    }

    $from = array();
    $from[0][0] = trim($this->From);
    $from[0][1] = $this->FromName;
    $result .= $this->AddrAppend('From', $from);

    // sendmail and mail() extract Cc from the header before sending
    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
      $result .= $this->AddrAppend('Cc', $this->cc);
    }

    // sendmail and mail() extract Bcc from the header before sending
    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
      $result .= $this->AddrAppend('Bcc', $this->bcc);
    }

    if(count($this->ReplyTo) > 0) {
      $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
    }

    // mail() sets the subject itself
    if($this->Mailer != 'mail') {
      $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
    }

    if($this->MessageID != '') {
      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
    } else {
      $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
    }
    $result .= $this->HeaderLine('X-Priority', $this->Priority);
    $result .= $this->HeaderLine('X-Mailer', 'PHPMailer ' . self::VERSION . ' (phpmailer.codeworxtech.com)');

    if($this->ConfirmReadingTo != '') {
      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
    }

    // Add custom headers
    for($index = 0; $index < count($this->CustomHeader); $index++) {
      $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
    }
    if (!$this->sign_key_file) {
      $result .= $this->HeaderLine('MIME-Version', '1.0');
      $result .= $this->GetMailMIME();
    }

    return $result;
  }
959452
public function buildMessage()
    {
        if (isset($this->message)) {
            return $this->message;
        }

        $this->message = [
            BuildUtil::removeNullElements([
                'type' => MessageType::FLEX,
                'altText' => $this->altText,
                'contents' => $this->containerBuilder->build(),
                'quickReply' => BuildUtil::build($this->quickReply, 'buildQuickReply'),
            ])
        ];

        return $this->message;
    }
1082449
public function build(): string
    {
        $html_attr = [];

        if (!$this->element) {
            $this->element = strtolower((new \ReflectionClass($this))->getShortName());
        }

        if (!empty($this->id)) {
            $html_attr['id'] = $this->id;
        }

        if (!empty($this->name)) {
            $html_attr['name'] = $this->name;
        }

        if ($this->css) {
            $this->css = array_unique($this->css);
            $html_attr['class'] = implode(' ', $this->css);
        }

        if ($this->style) {

            $styles = [];

            foreach ($this->style as $name => $val) {
                $styles[] = $name . ': ' . $val;
            }

            $html_attr['style'] = implode('; ', $styles);
        }

        if ($this->event) {
            foreach ($this->event as $event => $val) {
                $html_attr[$event] = $val;
            }
        }

        if ($this->data) {
            foreach ($this->data as $attr => $val) {
                $html_attr['data-' . $attr] = $val;
            }
        }

        if ($this->aria) {
            foreach ($this->aria as $attr => $val) {
                $html_attr['aria-' . $attr] = $val;
            }
        }

        if ($this->attribute) {
            foreach ($this->attribute as $attr => $val) {
                $html_attr[$attr] = $val;
            }
        }

        // we have all our attributes => build attribute string
        $tmp_attr = [];

        foreach ($html_attr as $name => $val) {
            $tmp_attr[] = $val === false ? $name : $name . (strpos($name, 'data') === false ? '="' . $val . '"' : '=\'' . $val . '\'');
        }

        $html_attr = implode(' ', $tmp_attr);

        // html attribute string has been created, lets build the element
        switch ($this->element) {

            case 'input':
            case 'meta':
            case 'img':
            case 'link':
                $html = '<' . $this->element . ($html_attr ? ' ' . $html_attr : '') . '>';
                break;

            default:
                $html = '<' . $this->element . ($html_attr ? ' ' . $html_attr : '') . '>' . $this->inner . '</' . $this->element . '>';
                break;
        }

        return $html;
    }
326754
public function ___build(): string
    {
        $this->escapeClass->doNotEscape($this->namesClass->getAliases());

        $tables = \implode(', ', $this->into);
        $fields = \implode(',', \array_keys($this->fields));
        $values = \implode(',', \array_map([$this->escapeClass, 'escape'], \array_values($this->fields)));

        return \sprintf('INSERT INTO %s (%s) VALUES (%s)', $tables, $fields, $values);
    }
1324817
public function Plain()
    {
        // Preserve line breaks
        $text = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $this->RAW());

        // Convert paragraph breaks to multi-lines
        $text = preg_replace('/\<\/p\>/i', "\n\n", $text);

        // Strip out HTML tags
        $text = strip_tags($text);

        // Implode >3 consecutive linebreaks into 2
        $text = preg_replace('~(\R){2,}~', "\n\n", $text);

        // Decode HTML entities back to plain text
        return trim(Convert::xml2raw($text));
    }
712960
private function buildLines($rawResult) {
        if(preg_match('@^CREATE TABLE `[^`]+` \(@', $rawResult, $matches)) {
            $rawResult = substr($rawResult, strlen($matches[0]));
        }
        $parseHelper = new ParseHelper();
        $lines = array();
        while(strlen($rawResult) > 0) {
            $section = $parseHelper->parseSection($rawResult, ',');
            $lines[] = $section;
            $rawResult = substr($rawResult, strlen($section) + 1);
            if($parseHelper->isTooManyClosingParenthesis()) {
                break;
            }
        }
        $lineObjects = [];
        $keyObjects = [];
        $constraintObjects = [];
        foreach($lines as $line) {
            $line = trim($line);
            if($line[0] == '`') {
                $lineObject = new Line($line);
                $lineObjects[$lineObject->getName()] = $lineObject;
            } elseif(preg_match('@^(PRIMARY |UNIQUE |)KEY @', $line)) {
                $keyObject = new Key($line);
                $keyObjects[$keyObject->getName()] = $keyObject;
            } elseif(preg_match('@^CONSTRAINT @', $line)) {
                $constraintObject = new Constraint($line);
                $constraintObjects[$constraintObject->getName()] = $constraintObject;
            }
        }
        $this->setLines($lineObjects);
        $this->setKeys($keyObjects);
        $this->setConstraints($constraintObjects);
        return $rawResult;
    }
12727
public function getRawHeaders(): string
    {
        if (null === $this->rawHeaders) {
            $rawHeaders = \imap_fetchheader($this->resource->getStream(), $this->getNumber(), \FT_UID);

            if (false === $rawHeaders) {
                throw new ImapFetchheaderException('imap_fetchheader failed');
            }

            $this->rawHeaders = $rawHeaders;
        }

        return $this->rawHeaders;
    }
278863
public function buildFileContainerTemplate() {
		$tr = Html::el("tr");
		
		$preview = Html::el("td")->addAttributes([
			"style" => "width: 15%"
		]);
		$preview->addHtml($this->elements["imagePreview"]->setAttribute("width", "100%"));
		$preview->addHtml($this->elements["filePreview"]);
		$tr->addHtml($preview);
		
		$name = Html::el("td");
		$name->addHtml($this->elements["filename"]);
		$tr->addHtml($name);
		
		$progress = Html::el("td");
		$progress->addHtml($this->elements["fileProgress"])->addAttributes([
			"style" => "width: 20%"
		]);
		$tr->addHtml($progress);
		
		$delete = Html::el("td")->addAttributes([
			"style" => "width: 50px; text-align: center",
		]);
		$delete->addHtml($this->elements["delete"]);
		$tr->addHtml($delete);
		
		return $tr;
	}
271449
public function build()
    {
        $mainPart = false;

        // create the text part if there is one
        if ( $this->plainText != '' )
        {
            $mainPart = new ezcMailText( $this->plainText, $this->charset );
        }

        // create the HTML part if there is one
        $htmlPart = false;
        if ( $this->htmlText != '' )
        {
            $htmlPart = $this->generateHtmlPart();

            // create a MultiPartAlternative if a text part exists
            if ( $mainPart != false )
            {
                $mainPart = new ezcMailMultipartAlternative( $mainPart, $htmlPart );
            }
            else
            {
                $mainPart = $htmlPart;
            }
        }

        // build all attachments
        // special case, mail with no text and one attachment.
        // A fix for issue #14220 was added by wrapping the attachment in
        // an ezcMailMultipartMixed part
        if ( $mainPart == false && count( $this->attachments ) == 1 )
        {
            if ( isset( $this->attachments[0][1] ) )
            {
                if ( is_resource( $this->attachments[0][1] ) )
                {
                    $mainPart = new ezcMailMultipartMixed( new ezcMailStreamFile( $this->attachments[0][0], $this->attachments[0][1], $this->attachments[0][2], $this->attachments[0][3] ) );
                }
                else
                {
                    $mainPart = new ezcMailMultipartMixed( new ezcMailVirtualFile( $this->attachments[0][0], $this->attachments[0][1], $this->attachments[0][2], $this->attachments[0][3] ) );
                }
            }
            else
            {
                $mainPart = new ezcMailMultipartMixed( new ezcMailFile( $this->attachments[0][0], $this->attachments[0][2], $this->attachments[0][3] ) );
            }
            $mainPart->contentDisposition = $this->attachments[0][4];
        }
        else if ( count( $this->attachments ) > 0 )
        {
            $mainPart = ( $mainPart == false )
                ? new ezcMailMultipartMixed()
                : new ezcMailMultipartMixed( $mainPart );

            // add the attachments to the mixed part
            foreach ( $this->attachments as $attachment )
            {
                if ( isset( $attachment[1] ) )
                {
                    if ( is_resource( $attachment[1] ) )
                    {
                        $part = new ezcMailStreamFile( $attachment[0], $attachment[1], $attachment[2], $attachment[3] );
                    }
                    else
                    {
                        $part = new ezcMailVirtualFile( $attachment[0], $attachment[1], $attachment[2], $attachment[3] );
                    }
                }
                else
                {
                    $part = new ezcMailFile( $attachment[0], $attachment[2], $attachment[3] );
                }
                $part->contentDisposition = $attachment[4];
                $mainPart->appendPart( $part );
            }
        }

        $this->body = $mainPart;
    }
865215
public function build()
    {
        if (isset($this->styles)) {
            return $this->styles;
        }

        $this->styles = BuildUtil::removeNullElements([
            'header' => BuildUtil::build($this->headerStyleBuilder),
            'hero' => BuildUtil::build($this->heroStyleBuilder),
            'body' => BuildUtil::build($this->bodyStyleBuilder),
            'footer' => BuildUtil::build($this->footerStyleBuilder),
        ]);

        return $this->styles;
    }
48047
public function build()
    {
        $stream = new Stream('php://temp', 'wb+');


        $stream->write(json_encode(new MessageDecorator($this->getMessage())));

        return $this->getHttpMessage()
            ->withAddedHeader('Content-Type', 'application/json')
            ->withBody($stream);
    }
406265
protected function buildInlineCode() {
        $result = '';
        foreach ($this->events as $event) {
            /* @var $event \ManiaScript\Builder\Event\AbstractEvent */
            if ($event->getInline()) {
                $result .= $event->getCode() . PHP_EOL;
            } else {
                $result .= $this->buildHandlerFunctionCall($event);
            }
        }
        return $result;
    }
1192073
public function getEnvelope()
    {
        return isset($this->_data[Horde_Imap_Client::FETCH_ENVELOPE])
            ? clone $this->_data[Horde_Imap_Client::FETCH_ENVELOPE]
            : new Horde_Imap_Client_Data_Envelope();
    }
385571
public function build(): string
    {
        $table = $this->quoter->quoteName($this->table);

        $insert = 'INSERT';
        if (!empty($this->priority)) {
            $insert .= ' ' . $this->priority;
        }
        if (!empty($this->ignore)) {
            $insert .= ' ' . $this->ignore;
        }

        if (array_key_exists(0, $this->values)) {
            // multiple rows
            $result = sprintf('%s INTO %s (%s) VALUES', $insert, $table, $this->quoter->quoteFields($this->values[0]));
            foreach ($this->values as $key => $row) {
                $result .= sprintf('%s(%s)', ($key > 0) ? ',' : '', $this->quoter->quoteBulkValues($row));
            }
        } else {
            // single row
            $result = sprintf('%s INTO %s SET %s', $insert, $table, $this->quoter->quoteSetValues($this->values));
        }

        if ($this->duplicateValues) {
            $values = $this->quoter->quoteSetValues($this->duplicateValues);
            $result .= sprintf(' ON DUPLICATE KEY UPDATE %s', $values);
        }
        $result .= ';';

        return $result;
    }
942386
public function build(): string
    {
        $sql = [];
        $sql = $this->getUpdateSql($sql);
        $sql = $this->getSetSql($sql);
        $sql = $this->condition->getWhereSql($sql);
        $sql = $this->getOrderBySql($sql);
        $sql = $this->getLimitSql($sql);
        $result = trim(implode(' ', $sql)) . ';';

        return $result;
    }