Magic method to convert the instance into an HTTP message string.

@return string
354995
public function toMessage()
    {
        $this->_setContentLength();
        return $this->line() . "\r\n" . $this->headers()->toString() . "\r\n". "\r\n" . $this->toString();
    }
1173813
public function getEncodedMessage(): string
    {
        $output = '';
        $boundary = '--------' . Generators::random();

        foreach ($this->headers as $name => $value) {
            $output .= $name . ': ' . $this->getEncodedHeader($name);
            if ($this->parts && $name === 'Content-Type') {
                $output .= ';' . self::EOL . "\tboundary=\"$boundary\"";
            }
            $output .= self::EOL;
        }
        $output .= self::EOL;

        $body = $this->body;
        if ($body !== '') {
            switch ($this->getEncoding()) {
                case self::ENCODING_QUOTED_PRINTABLE:
                    $output .= \quoted_printable_encode($body);
                    break;

                case self::ENCODING_BASE64:
                    $output .= \rtrim(\chunk_split(\base64_encode($body), self::LINE_LENGTH, self::EOL));
                    break;

                case self::ENCODING_7BIT:
                    $body = \preg_replace('#[\x80-\xFF]+#', '', $body);
                // break intentionally omitted

                case self::ENCODING_8BIT:
                    $output .= \str_replace(["\x00", "\r", "\n"], ['', '', self::EOL], $body);
                    break;

                default:
                    throw new RuntimeException('Unknown encoding.');
            }
        }

        if ($this->parts) {
            if (\substr($output, -\strlen(self::EOL)) !== self::EOL) {
                $output .= self::EOL;
            }
            foreach ($this->parts as $part) {
                $output .= '--' . $boundary . self::EOL . $part->getEncodedMessage() . self::EOL;
            }
            $output .= '--' . $boundary . '--';
        }

        return $output;
    }
15368
public function getString()
    {
        $html = '';
        if ($this->error->has()) {
            $html .= '<ul class="ccm-error">';
            foreach ($this->error->getList() as $error) {
                $html .= '<li>';
                if ($error instanceof HtmlAwareErrorInterface && $error->messageContainsHtml()) {
                    $html .= (string) $error;
                } else {
                    $html .= nl2br(h((string) $error));
                }
                $html .= '</li>';
            }
            $html .= '</ul>';
        }

        return $html;
    }
88499
public function getMessageString()
    {
        $str = implode(' ', $this->header);
        if (count($this->structuredData)) {
            $str .= ' ' . implode('', $this->structuredData);
        } else {
            $str .= ' ' . self::NILVALUE;
        }
        $str .= ' ' . $this->msg;
        return $str;
    }
907412
public function getRawMessage(): string
    {
        if (null === $this->rawMessage) {
            $this->rawMessage = $this->doGetContent('');
        }

        return $this->rawMessage;
    }
1315252
public function toString()
    {
        $newLine = "\n";
        $string = $newLine . $newLine;

        $i = 0;
        foreach ($this->dns as $dns) {
            ++$i;
            $string .= 'DNS.' . $i . ' = ' . $dns .$newLine;
        }

        $i = 0;
        foreach ($this->ip as $ip) {
            ++$i;
            $string .= 'IP.' . $i . ' = ' . $ip .$newLine;
        }

        $i = 0;
        foreach ($this->url as $url) {
            ++$i;
            $string .= 'URL.' . $i . ' = ' . $url .$newLine;
        }

        return $string;
    }
1127612
public function toString()
    {
        $namespace = $this->namespaces ?
                        implode(self::NAMESPACE_SEPARATOR, $this->namespaces) 
                            . self::NAMESPACE_SEPARATOR
                        : '';
        return $namespace . $this->controller . self::METHOD_SEPARATOR . $this->action;
    }
563278
public function toString()
    {
        $output = 'data:';

        if (($this->getMediaType() !== self::DEFAULT_TYPE) || ($this->getEncoding() !== self::ENCODING_URL_ENCODED_OCTETS)) {
            $output .= $this->getMediaType();

            if ($this->getEncoding() === self::ENCODING_BASE64) {
                $output .= ';'.self::BASE64_KEYWORD;
            }
        }

        $output .= ','.$this->getEncodedData();

        return $output;
    }
262024
public function toMessage()
    {
        $m = new Message(array(
            $this->getRequestId(),
            $this->getActionName(),
        ));
        $m->append($this->getParameters());

        return $m;
    }
1230644
public function toString()
    {
        $parts = [];
        $data = $this->data();
        $parts[] = $data['name'] . '=' . rawurlencode($data['value']);

        if ($data['domain']) {
            $parts[] = 'Domain=' . $data['domain'];
        }
        if ($data['path']) {
            $parts[] = 'Path=' . $data['path'];
        }
        if (isset($data['max-age'])) {
            $parts[] = 'Max-Age=' . (string) $data['max-age'];
        } elseif (isset($data['expires'])) {
            $parts[] = 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $data['expires']);
        }
        if ($data['secure']) {
            $parts[] = 'Secure';
        }
        if ($data['httponly']) {
            $parts[] = 'HttpOnly';
        }
        return join('; ', $parts);
    }
96052
public static function getProtocol() {
    if(null === self::$protocol) {
      self::$protocol = @trim($_SERVER['SERVER_PROTOCOL']);
      if(!self::$protocol) {
        self::$protocol = 'HTTP/1.0';
      }
    }
    return self::$protocol;
  }
39136
public function toString()
    {
        $data = $this->toArray();

        // Root should be JSON object, not array
        if (count($data) === 0) {
            $data = new ArrayObject();
        }

        // Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
        $data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES);

        if (JSON_ERROR_NONE !== json_last_error())
        {
            throw new InvalidArgumentException(
                'Cannot encode data to JSON string: ' . json_last_error_msg()
            );
        }

        return $data;
    }
437301
public function toString()
    {
        if (empty($this->headerSigners) && empty($this->bodySigners)) {
            return parent::toString();
        }

        $this->saveMessage();

        $this->doSign();

        $string = parent::toString();

        $this->restoreMessage();

        return $string;
    }
1250891
public function toString()
    {
        $result = '';
        if ($this->hasHeaders()) {
            $headers = $this->composeHeaderLines();
            $result .= implode("\n", $headers);
        }

        $content = $this->getContent();
        if ($content !== null) {
            $result .= "\n\n" . $content;
        }

        return $result;
    }
896349
static function httpCharset()
    {
        $realCharset =& $GLOBALS['eZTextCodecHTTPCharsetReal'];
        if ( !isset( $realCharset ) )
        {
            $charset = '';
            if ( isset( $GLOBALS['eZTextCodecHTTPCharset'] ) )
                $charset = $GLOBALS['eZTextCodecHTTPCharset'];
            if ( $charset == '' )
            {
                if ( isset( $GLOBALS['eZTextCodecInternalCharsetReal'] ) )
                    $realCharset = $GLOBALS['eZTextCodecInternalCharsetReal'];
                else
                    $realCharset = eZTextCodec::internalCharset();
            }
            else
            {
                $realCharset = eZCharsetInfo::realCharsetCode( $charset );
            }
        }
        return $realCharset;
    }
705903
public function toString ()
	{
		$content = "<VirtualHost {$this->address}:{$this->port}>" . PHP_EOL;
		
		foreach ($this->directives as $directive) {
			$content .= $directive->toString() . PHP_EOL;
		}
		
		$content .= PHP_EOL;
		
		foreach ($this->directories as $directory) {
			$content .= $directory->toString() . PHP_EOL;
		}
		$content .= PHP_EOL;
		
		$content .= "</VirtualHost>";
		
		return $content;
	}
876506
public function toString()
    {
        $string = '';

        if ($this->scheme) {
            $slashes = $this->isFlat() ? '' : '//';
            $string .= "{$this->scheme}:$slashes";
        }

        if ($authority = $this->getAuthority()) {
            $string .= $authority;
        }

        if ($this->path->count() && !$this->isFlat()) {
            $prefix = $authority || $this->path->getPrefix() ? '/' : '';
            $string .= $prefix.ltrim((string) $this->path, '/');
        }

        if ($this->query) {
            $string .= '?'.http_build_query($this->query);
        }

        if ($this->fragment) {
            $string .= "#{$this->fragment}";
        }

        return $string;
    }