Mercurial > hg > isophonics-drupal-site
comparison vendor/zendframework/zend-diactoros/src/Response/EmptyResponse.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 /** | |
3 * Zend Framework (http://framework.zend.com/) | |
4 * | |
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 | |
8 */ | |
9 | |
10 namespace Zend\Diactoros\Response; | |
11 | |
12 use Zend\Diactoros\Response; | |
13 use Zend\Diactoros\Stream; | |
14 | |
15 /** | |
16 * A class representing empty HTTP responses. | |
17 */ | |
18 class EmptyResponse extends Response | |
19 { | |
20 /** | |
21 * Create an empty response with the given status code. | |
22 * | |
23 * @param int $status Status code for the response, if any. | |
24 * @param array $headers Headers for the response, if any. | |
25 */ | |
26 public function __construct($status = 204, array $headers = []) | |
27 { | |
28 $body = new Stream('php://temp', 'r'); | |
29 parent::__construct($body, $status, $headers); | |
30 } | |
31 | |
32 /** | |
33 * Create an empty response with the given headers. | |
34 * | |
35 * @param array $headers Headers for the response. | |
36 * @return EmptyResponse | |
37 */ | |
38 public static function withHeaders(array $headers) | |
39 { | |
40 return new static(204, $headers); | |
41 } | |
42 } |