@@ -19,39 +19,39 @@ |
||
19 | 19 | */ |
20 | 20 | class ServerResponse extends Response |
21 | 21 | { |
22 | - /** |
|
23 | - * Construct a ServerResponse object with the given status code, reason phrase, version, headers & body. |
|
24 | - * |
|
25 | - * @param int $statusCode |
|
26 | - * @param string $reasonPhrase = '' |
|
27 | - * @param string $version = self::DEFAULT_VERSION |
|
28 | - * @param array $headers = [] |
|
29 | - * @param StreamInterface|null $body = null |
|
30 | - */ |
|
31 | - public function __construct($statusCode, $reasonPhrase = '', $version = self::DEFAULT_VERSION, array $headers = [], StreamInterface $body = null) |
|
32 | - { |
|
33 | - if ($body === null) { |
|
34 | - $body = new Stream(fopen('php://output', 'w')); |
|
35 | - } |
|
36 | - |
|
37 | - parent::__construct($statusCode, $reasonPhrase, $version, $headers, $body); |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * Send the server response. |
|
42 | - * |
|
43 | - * @return null |
|
44 | - */ |
|
45 | - public function send() |
|
46 | - { |
|
47 | - if ($this->getProtocolVersion() && $this->getStatusCode()) { |
|
48 | - header(static::VERSION_DELIMITER . $this->getProtocolVersion() . ' ' . $this->getStatusCode() . ' ' . $this->getReasonPhrase()); |
|
49 | - } |
|
50 | - |
|
51 | - foreach ($this->getHeaders() as $key => $value) { |
|
52 | - header($key . static::HEADER_DELIMITER . implode(static::HEADER_VALUE_DELIMITER, $value)); |
|
53 | - } |
|
54 | - |
|
55 | - echo $this->getBody(); |
|
56 | - } |
|
22 | + /** |
|
23 | + * Construct a ServerResponse object with the given status code, reason phrase, version, headers & body. |
|
24 | + * |
|
25 | + * @param int $statusCode |
|
26 | + * @param string $reasonPhrase = '' |
|
27 | + * @param string $version = self::DEFAULT_VERSION |
|
28 | + * @param array $headers = [] |
|
29 | + * @param StreamInterface|null $body = null |
|
30 | + */ |
|
31 | + public function __construct($statusCode, $reasonPhrase = '', $version = self::DEFAULT_VERSION, array $headers = [], StreamInterface $body = null) |
|
32 | + { |
|
33 | + if ($body === null) { |
|
34 | + $body = new Stream(fopen('php://output', 'w')); |
|
35 | + } |
|
36 | + |
|
37 | + parent::__construct($statusCode, $reasonPhrase, $version, $headers, $body); |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * Send the server response. |
|
42 | + * |
|
43 | + * @return null |
|
44 | + */ |
|
45 | + public function send() |
|
46 | + { |
|
47 | + if ($this->getProtocolVersion() && $this->getStatusCode()) { |
|
48 | + header(static::VERSION_DELIMITER . $this->getProtocolVersion() . ' ' . $this->getStatusCode() . ' ' . $this->getReasonPhrase()); |
|
49 | + } |
|
50 | + |
|
51 | + foreach ($this->getHeaders() as $key => $value) { |
|
52 | + header($key . static::HEADER_DELIMITER . implode(static::HEADER_VALUE_DELIMITER, $value)); |
|
53 | + } |
|
54 | + |
|
55 | + echo $this->getBody(); |
|
56 | + } |
|
57 | 57 | } |
@@ -45,11 +45,11 @@ |
||
45 | 45 | public function send() |
46 | 46 | { |
47 | 47 | if ($this->getProtocolVersion() && $this->getStatusCode()) { |
48 | - header(static::VERSION_DELIMITER . $this->getProtocolVersion() . ' ' . $this->getStatusCode() . ' ' . $this->getReasonPhrase()); |
|
48 | + header(static::VERSION_DELIMITER.$this->getProtocolVersion().' '.$this->getStatusCode().' '.$this->getReasonPhrase()); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | foreach ($this->getHeaders() as $key => $value) { |
52 | - header($key . static::HEADER_DELIMITER . implode(static::HEADER_VALUE_DELIMITER, $value)); |
|
52 | + header($key.static::HEADER_DELIMITER.implode(static::HEADER_VALUE_DELIMITER, $value)); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | echo $this->getBody(); |