/** * Returns a string representation of the current request. * * @return string */ public function __toString() { return implode(PHP_EOL, array(sprintf('%s %s HTTP/%.1f', $this->getMethod(), $this->getResource(), $this->getProtocolVersion()), 'Host: ' . $this->getHost())) . PHP_EOL . parent::__toString(); }
/** * Returns a string representation of the current request. * * @return string */ public function __toString() { $string = sprintf("%s %s HTTP/%.1f\r\n", $this->getMethod(), $this->getResource(), $this->getProtocolVersion()); if ($host = $this->getHost()) { $string .= 'Host: ' . $host . "\r\n"; } if ($parent = trim(parent::__toString())) { $string .= $parent . "\r\n"; } return $string; }