Gets a string representation of the headers of the given HTTP message.

@param ehough_shortstop_api_HttpMessage $message The HTTP message.

@return string The string representation of the HTTP headers. May be null or empty.
438565
public final function getHeaderArrayAsString(ehough_shortstop_api_HttpMessage $message)
    {
        $headers = $message->getAllHeaders();

        if (! is_array($headers)) {

            return '';
        }

        $toReturn = '';

        foreach ($headers as $name => $value) {

            $toReturn .= "$name: $value\r\n";
        }

        return $toReturn;
    }
680739
function headerText( $parameters = array() )
    {
        $convert = true;
        if ( isset( $parameters['convert'] ) )
            $convert = $parameters['convert'];
        $text = '';
        $headers = $this->headers( $parameters );
        $headerCount = 0;
        foreach ( $headers as $header )
        {
            if ( $headerCount++ > 0 )
                $text .= eZMail::lineSeparator();
            $text .= $this->blankNewlines( $header['name'] ) . ': ';
            $contentText = $this->blankNewlines( $this->contentString( $header['content'] ) );
            $text .= $contentText;
        }
        return $text;
    }
851131
public function translate($message, ... $parameters): string {
    $count = $parameters[0] ?? 0;
    $params = $parameters[1] ?? [];
    list($domain, $m) = $this->extractDomainAndMessage($message);
    $texts = Arrays::get($this->loader->getTexts(), $domain, []);
    $parts = explode(".", $m);
    if(count($parts) === 1) {
      $parts = [$m];
    }
    $text = $this->multiLevelTrans($parts, $texts);
    if($text === "") {
      $this->onUntranslated($message);
      return $message;
    }
    if($this->messageSelector->isMultiChoice($text)) {
      $text = $this->messageSelector->choose($text, $count);
    }
    $params["count"] = $count;
    foreach($params as $key => $value) {
      $text = str_replace("%$key%", $value, $text);
    }
    return $text;
  }
1232812
private function formatMessage($message)
    {
        $formattedMessage = implode('', (array)$message);
        $formattedMessage = str_replace(PHP_EOL, '', $formattedMessage);
        $formattedMessage = strip_tags($formattedMessage);
        $formattedMessage = preg_replace([
            '/\\x1b[[][^A-Za-z]*[A-Za-z]/',
            '/[-=]{2,}/',
        ], '', $formattedMessage);

        return $formattedMessage !== null
            ? trim($formattedMessage, " \t\n\r\0\x0B-=")
            : (string)$formattedMessage;
    }
237768
private function formatMessage(string $message, array $params): string
    {
        $params = \array_values($params);
        \array_unshift($params, $message);
        
        return \sprintf(...$params);
    }
676879
public function getTrace($message): string
    {
        $traces = debug_backtrace();
        $count = \count($traces);
        $ex = '';
        if ($count >= 7) {
            $info = $traces[6];
            if (isset($info['file'], $info['line'])) {
                $filename = basename($info['file']);
                $lineNum = $info['line'];
                $ex = "$filename:$lineNum";
            }
        }
        if ($count >= 8) {
            $info = $traces[7];
            if (isset($info['class'], $info['type'], $info['function'])) {
                $ex .= ',' . $info['class'] . $info['type'] . $info['function'];
            } elseif (isset($info['function'])) {
                $ex .= ',' . $info['function'];
            }
        }

        if (!empty($ex)) {
            $message = "trace[$ex] " . $message;
        }


        return $message;
    }
858122
public function formatMessage(array $message): string
    {
        [$level, $text, $context] = $message;
        $category = $context['category'];
        $timestamp = $context['time'];
        $level = Logger::getLevelName($level);
        $traces = [];
        if (isset($context['trace'])) {
            foreach ($context['trace'] as $trace) {
                $traces[] = "in {$trace['file']}:{$trace['line']}";
            }
        }

        $prefix = $this->getMessagePrefix($message);

        return $this->getTime($timestamp) . " {$prefix}[$level][$category] $text"
            . (empty($traces) ? '' : "\n    " . implode("\n    ", $traces));
    }
1329457
public static function message($message) {

        return (new Color())->getColoredString(sprintf(self::MESSAGE, self::date(), $message), 'black', 'light_gray').PHP_EOL;

    }
531568
public function sendMessage(string $message) : ?Message 
    {
        $thread = $this->messageGroup();

        if ($thread === null) return null;

        return $thread->sendMessage($message);
    }
674763
protected function get_email_from_header($message, $header)
    {
        $value = $message->headers->get($header, false);

        if (strtolower($header) == 'received') {
            // find first email address in all Received headers
            $email = null;
            foreach ((array) $value as $entry) {
                if (preg_match('/[\s\t]+for[\s\t]+<([^>]+)>/', $entry, $matches)) {
                    $email = $matches[1];
                    break;
                }
            }

            $value = $email;
        }

        return (array) $value;
    }
1374219
private function persistHeaders(MessageInterface $message)
    {
        // Clone the response to not destroy any necessary headers when caching
        $headers = array_diff_key($message->getHeaders(), self::$noCache);

        // Cast the headers to a string
        foreach ($headers as &$value) {
            $value = implode(', ', $value);
        }

        return $headers;
    }
1271306
function formatAddressField($message, $field)
    {
        $headers = $message->getHeaders();

        if (!$headers->has($field)) {
            return null;
        }

        $mailboxes = $headers->get($field)->getFieldBodyModel();

        $strings = [];
        foreach ($mailboxes as $email => $name) {
            $mailboxStr = $email;
            if (null !== $name) {
                $mailboxStr = $name . ' <' . $mailboxStr . '>';
            }
            $strings[] = $mailboxStr;
        }
        return implode(', ', $strings);
    }
348417
public static function encodeMessage($message)
    {
        $waitingData = strlen($message);
        $header = str_pad((string)$waitingData,8,'0',STR_PAD_LEFT);
        return $header.$message;
    }
885350
private function getHttpHeadersAsString($headers)
    {
        if (count($headers) == 0) {
            return '';
        }

        $max = max(array_map('strlen', array_keys($headers))) + 1;
        $content = '';
        ksort($headers);
        foreach ($headers as $name => $values) {
            foreach ($values as $value) {
                $content .= sprintf("%-{$max}s %s\r\n", $this->beautifyHeaderName($name).':', $value);
            }
        }

        return $content;
    }
627248
public static function response(string $message = null, int $code = null, array $headers = [])
  {
    $rest = new Rest;
    $rest->message = $message;

    if ($headers != []) {
      foreach($headers as $field => $i) {
        array_push($rest->headers, $field .': '. $i);
      }
    }

    if ($code != null) {
      $rest->code = $code;
      header('HTTP/1.1 '.$rest->code);
      return $rest->send();
    }

    return $rest;
  }
433381
protected function handleMessage($message)
    {
        if (!is_null($response = $this->call('message.*', array($message)))) {
            return $response;
        }

        return $this->call("message.{$message['MsgType']}", array($message));
    }
845531
private function uriSafeDecode($message)
    {
        $message = str_replace(['-', '_'], ['+', '/'], $message);

        $decoded = base64_decode($message, true);
        if (!is_string($decoded)) {
            return null;
        }

        return $decoded;
    }