3 * Zend Framework (http://framework.zend.com/)
5 * @see http://github.com/zendframework/zend-diactoros for the canonical source repository
6 * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
10 namespace Zend\Diactoros\Response;
12 use Zend\Diactoros\Response;
13 use Zend\Diactoros\Stream;
16 * A class representing empty HTTP responses.
18 class EmptyResponse extends Response
21 * Create an empty response with the given status code.
23 * @param int $status Status code for the response, if any.
24 * @param array $headers Headers for the response, if any.
26 public function __construct($status = 204, array $headers = [])
28 $body = new Stream('php://temp', 'r');
29 parent::__construct($body, $status, $headers);
33 * Create an empty response with the given headers.
35 * @param array $headers Headers for the response.
36 * @return EmptyResponse
38 public static function withHeaders(array $headers)
40 return new static(204, $headers);