Promote Response::getStatusLine() to public

Fix issue where response phrase was not set in Response constructor.
This commit is contained in:
PJ Dietz 2014-04-07 16:25:22 -04:00
parent 8049635837
commit 566384f1e4
1 changed files with 13 additions and 13 deletions

View File

@ -53,7 +53,7 @@ class Response extends Message implements ResponseInterface
{
parent::__construct();
$this->statusCode = $statusCode;
$this->setStatusCode($statusCode);
if (is_array($headers)) {
$this->headers = $headers;
@ -124,6 +124,18 @@ class Response extends Message implements ResponseInterface
return $this->statusCode;
}
/** @return string HTTP status line, e.g. HTTP/1.1 200 OK. */
public function getStatusLine()
{
return sprintf(
'%s/%s %s %s',
strtoupper($this->protocol),
$this->protocolVersion,
$this->statusCode,
$this->reasonPhrase
);
}
/**
* Set the status code and optionally the reason phrase explaining it.
*
@ -295,18 +307,6 @@ class Response extends Message implements ResponseInterface
// -------------------------------------------------------------------------
/** @return string HTTP status line, e.g. HTTP/1.1 200 OK. */
protected function getStatusLine()
{
return sprintf(
'%s/%s %s %s',
strtoupper($this->protocol),
$this->protocolVersion,
$this->statusCode,
$this->reasonPhrase
);
}
/** Output the contents of a file */
private function outputBodyFile()
{