1 | <?php |
||
10 | class ResponseBuilder |
||
11 | { |
||
12 | /** |
||
13 | * The response to be built. |
||
14 | * |
||
15 | * @var ResponseInterface |
||
16 | */ |
||
17 | protected $response; |
||
18 | |||
19 | /** |
||
20 | * Create builder for the given response. |
||
21 | * |
||
22 | * @param ResponseInterface $response |
||
23 | */ |
||
24 | 3 | public function __construct(ResponseInterface $response) |
|
28 | |||
29 | /** |
||
30 | * Return response. |
||
31 | * |
||
32 | * @return ResponseInterface |
||
33 | */ |
||
34 | public function getResponse() |
||
38 | |||
39 | /** |
||
40 | * Add headers represented by an array of header lines. |
||
41 | * |
||
42 | * @param string[] $headers Response headers as array of header lines. |
||
43 | * |
||
44 | * @return $this |
||
45 | * |
||
46 | * @throws \UnexpectedValueException For invalid header values. |
||
47 | * @throws \InvalidArgumentException For invalid status code arguments. |
||
48 | */ |
||
49 | 2 | public function setHeadersFromArray(array $headers) |
|
87 | |||
88 | /** |
||
89 | * Add headers represented by a single string. |
||
90 | * |
||
91 | * @param string $headers Response headers as single string. |
||
92 | * |
||
93 | * @return $this |
||
94 | * |
||
95 | * @throws \InvalidArgumentException if $headers is not a string on object with __toString() |
||
96 | * @throws \UnexpectedValueException For invalid header values. |
||
97 | */ |
||
98 | 1 | public function setHeadersFromString($headers) |
|
115 | } |
||
116 |