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) |
|
62 | |||
63 | /** |
||
64 | * Add headers represented by a single string. |
||
65 | * |
||
66 | * @param string $headers Response headers as single string. |
||
67 | * |
||
68 | * @return $this |
||
69 | * |
||
70 | * @throws \InvalidArgumentException if $headers is not a string on object with __toString() |
||
71 | * @throws \UnexpectedValueException For invalid header values. |
||
72 | */ |
||
73 | 1 | public function setHeadersFromString($headers) |
|
91 | |||
92 | /** |
||
93 | * Add header represented by a string. |
||
94 | * |
||
95 | * @param string $headerLine Response header as a string. |
||
96 | * |
||
97 | * @return $this |
||
98 | * |
||
99 | * @throws \UnexpectedValueException For invalid header values. |
||
100 | * @throws \InvalidArgumentException For invalid header names or values. |
||
101 | */ |
||
102 | 2 | public function addHeader($headerLine) |
|
134 | } |
||
135 |