Builds the message header.

@return HNHBK
332034
protected function buildMessageHeader()
    {
        $len = 0;
        foreach ($this->segments as $segment) {
            $len += strlen($segment);
        }

        return new HNHBK($len, $this->dialogId, $this->messageNumber);
    }
186391
protected function buildVariableHeader()
    {
        $header = '';

        $topic = $this->message->getTopic();
        # Topic
        $header .= Utility::PackStringWithLength($topic);
        Debug::Log(Debug::DEBUG, 'Message PUBLISH: topic='.$topic);

        Debug::Log(Debug::DEBUG, 'Message PUBLISH: QoS='.$this->getQos());
        Debug::Log(Debug::DEBUG, 'Message PUBLISH: DUP='.$this->getDup());
        Debug::Log(Debug::DEBUG, 'Message PUBLISH: RETAIN='.$this->getRetain());

        # Message ID if QoS > 0
        if ($this->getQos()) {
            if (!$this->msgid) {
                throw new Exception('MsgID MUST be set if QoS is not 0.');
            }

            $header .= $this->packPacketIdentifer();
        }

        return $header;
    }
314632
public function sendHeaders()
    {
        foreach ($this->getHeaders() as $name => $values) {
            foreach ($values as $value) {
                header(sprintf('%s: %s', $name, $value), false);
            }
        }

        return $this;
    }
446290
private function buildHttpResponse()
    {
        $status_text = static::$header[$this->code] ?? 'Unkdown';

        @header('HTTP/1.1 '. $this->code .' '. $status_text, $this->override, $this->code);

        foreach ($this->getHeaders() as $key => $header) {
            header(sprintf('%s: %s', $key, $header));
        }

        if ($this->download) {
            readfile($this->download_filename);

            die;
        }

        return $this->getContent();
    }
1330361
public function createMultiSchemeHeader()
    {
        $headers = [];
        foreach ($this->schemes as $name => $scheme) {
            $headers[$name] = $scheme->createResponseHeaderValue();
        }

        return new HttpHeader(
            $this->schemeHeader,
            sprintf('%s %s', implode('|', array_keys($headers)), implode('|', array_values($headers)))
        );
    }
1227229
public function toString()
    {
        $string = (string) $this->buildMessageHeader();

        foreach ($this->segments as $segment) {
            $string .= (string) $segment;
        }

        return $string;
    }
709977
public function generateHeader()
    {
        $format     = 'Rounds="%s", App="%s", Nonce="%s", Token="%s", Realm="%s", User="%s"';
        $expiresAt  = null;

        if ($this->getExpiresAt()) {
            $format = $format . ', ExpiresAt="%s"';
            $expiresAt  = $this->getExpiresAt()->format(\DateTime::ATOM);
        }

        return sprintf(
            $format,
            $this->getRounds(),
            $this->getApp(),
            $this->getNonce(),
            $this->getToken(),
            $this->getRealm(),
            $this->getUser(),
            $expiresAt
        );
    }
1352523
public function messageBoard()
    {
        $messageBoard = collect($this->dock)->where('name', 'message_board')
                                            ->first();
        $messageBoard->bucket = $this;
        return new MessageBoard($messageBoard);
    }
860933
public function build(): SetExtraHTTPHeadersRequest
	{
		$instance = new SetExtraHTTPHeadersRequest();
		if ($this->headers === null) {
			throw new BuilderException('Property [headers] is required.');
		}
		$instance->headers = $this->headers;
		return $instance;
	}
620217
public function headerFlashMessengerAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');
        $flashMessenger = $this->getServiceLocator()->get('MelisCoreFlashMessenger');
         
        $view = new ViewModel();
        $view->melisKey = $melisKey;
        $view->flashMessages = $this->getflashMessageAction();
        
        return $view;
    }
606930
public function build()
    {
        return $this->subject('Contact Us - ' . config('app.name'))
            ->to($this->contactUs->email, $this->contactUs->fullname)
            ->markdown('titan::emails.contactus_client');
    }
820513
public function createHeader()
    {
        $result = '';

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

        if ($this->MessageDate == '') {
            $this->MessageDate = self::rfcDate();
        }
        $result .= $this->headerLine('Date', $this->MessageDate);


        // To be created automatically by mail()
        if ($this->SingleTo === true) {
            if ($this->Mailer != 'mail') {
                foreach ($this->to as $toaddr) {
                    $this->SingleToArray[] = $this->addrFormat($toaddr);
                }
            }
        } else {
            if (count($this->to) > 0) {
                if ($this->Mailer != 'mail') {
                    $result .= $this->addrAppend('To', $this->to);
                }
            } elseif (count($this->cc) == 0) {
                $result .= $this->headerLine('To', 'undisclosed-recipients:;');
            }
        }

        $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));

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

        // sendmail and mail() extract Bcc from the header before sending
        if ((
                $this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
            )
            and 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 != '') {
            $this->lastMessageID = $this->MessageID;
        } else {
            $this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname());
        }
        $result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
        $result .= $this->headerLine('X-Priority', $this->Priority);
        if ($this->XMailer == '') {
            $result .= $this->headerLine(
                'X-Mailer',
                'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)'
            );
        } else {
            $myXmailer = trim($this->XMailer);
            if ($myXmailer) {
                $result .= $this->headerLine('X-Mailer', $myXmailer);
            }
        }

        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;
    }
995653
private function buildHeaderResponse()
    {
        foreach (explode(
            "\n",
            substr($this->output, 0, $this->info['header_size'])
        ) as $val) {
            $val = trim($val);
            if (! empty($val)) {
                $this->headerResponse[] = $val;
            }
        }
        $this->output = substr($this->output, $this->info['header_size']);
    }
223465
protected function buildVariableHeader()
    {
        $buffer = "";

        # Protocol Name
        if ($this->message->mqtt->version() == MQTT::VERSION_3_1_1) {
            $buffer .= Utility::PackStringWithLength('MQTT');

        } else {
            $buffer .= Utility::PackStringWithLength('MQIsdp');
        }
        # End of Protocol Name

        # Protocol Level
        $buffer .= chr($this->message->mqtt->version());

        # Connect Flags
        # Set to 0 by default
        $var = 0;
        # clean session
        if ($this->clean) {
            $var |= 0x02;
        }
        # Will flags
        if ($this->message->will) {
            $var |= $this->message->will->get();
        }

        # User name flag
        if ($this->message->username != NULL) {
            $var |= 0x80;
        }
        # Password flag
        if ($this->message->password != NULL) {
            $var |= 0x40;
        }

        $buffer .= chr($var);
        # End of Connect Flags

        # Keep alive: unsigned short 16bits big endian
        $buffer .= pack('n', $this->keepalive);

        return $buffer;
    }
1059189
public function buildMessage()
    {
        if (!empty($this->message)) {
            return $this->message;
        }

        foreach ($this->texts as $text) {
            $this->message[] = [
                'type' => MessageType::TEXT,
                'text' => $text,
            ];
        }

        if ($this->quickReply) {
            $lastKey = count($this->message) - 1;

            // If the user receives multiple message objects.
            // The quickReply property of the last message object is displayed.
            $this->message[$lastKey]['quickReply'] = $this->quickReply->buildQuickReply();
        }

        return $this->message;
    }
607224
protected function sendHeaders() {
        $context = Context::getInstance();
        $context->getResponse()->setContentHeader($this->contentType);
        header(HTTPToolkit::statusCodeHeader($this->httpCode));
        return $this;
    }
718619
private function buildCompleteHeader(): string
    {
        $header = "";
        foreach ($this->headers as $sourceType => $value) {
            $header .= $this->buildHeaderLine($sourceType, $value);
        }
        if (!empty($this->reportUri)) {
            $header .= 'report-uri ' . $this->reportUri . ';';
        }
        return $header;
    }