Construct the response
string $statusCode The response status code (e.g. 200, 404, etc):
Collection|array $headers The response headers:
string|resource|EntityBodyInterface $body The body of the response:
BadResponseException if an invalid response code is given
public function __construct($statusCode, $headers = null, $body = null) {
$this
->setStatus($statusCode);
$this->params = new Collection();
$this->body = EntityBody::factory($body !== null ? $body : '');
if ($headers) {
if (!is_array($headers) && !$headers instanceof Collection) {
throw new BadResponseException('Invalid headers argument received');
}
foreach ($headers as $key => $value) {
$this
->addHeaders(array(
$key => $value,
));
}
}
}