Mercurial > hg > isophonics-drupal-site
annotate vendor/zendframework/zend-diactoros/src/Response/EmptyResponse.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 /** |
Chris@0 | 3 * Zend Framework (http://framework.zend.com/) |
Chris@0 | 4 * |
Chris@0 | 5 * @see http://github.com/zendframework/zend-diactoros for the canonical source repository |
Chris@0 | 6 * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com) |
Chris@0 | 7 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License |
Chris@0 | 8 */ |
Chris@0 | 9 |
Chris@0 | 10 namespace Zend\Diactoros\Response; |
Chris@0 | 11 |
Chris@0 | 12 use Zend\Diactoros\Response; |
Chris@0 | 13 use Zend\Diactoros\Stream; |
Chris@0 | 14 |
Chris@0 | 15 /** |
Chris@0 | 16 * A class representing empty HTTP responses. |
Chris@0 | 17 */ |
Chris@0 | 18 class EmptyResponse extends Response |
Chris@0 | 19 { |
Chris@0 | 20 /** |
Chris@0 | 21 * Create an empty response with the given status code. |
Chris@0 | 22 * |
Chris@0 | 23 * @param int $status Status code for the response, if any. |
Chris@0 | 24 * @param array $headers Headers for the response, if any. |
Chris@0 | 25 */ |
Chris@0 | 26 public function __construct($status = 204, array $headers = []) |
Chris@0 | 27 { |
Chris@0 | 28 $body = new Stream('php://temp', 'r'); |
Chris@0 | 29 parent::__construct($body, $status, $headers); |
Chris@0 | 30 } |
Chris@0 | 31 |
Chris@0 | 32 /** |
Chris@0 | 33 * Create an empty response with the given headers. |
Chris@0 | 34 * |
Chris@0 | 35 * @param array $headers Headers for the response. |
Chris@0 | 36 * @return EmptyResponse |
Chris@0 | 37 */ |
Chris@0 | 38 public static function withHeaders(array $headers) |
Chris@0 | 39 { |
Chris@0 | 40 return new static(204, $headers); |
Chris@0 | 41 } |
Chris@0 | 42 } |