scratch – Blame information for rev 87
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
87 | office | 1 | <?php |
2 | |||
3 | namespace GuzzleHttp\Message; |
||
4 | |||
5 | use GuzzleHttp\Stream\StreamInterface; |
||
6 | |||
7 | /** |
||
8 | * Request and response message interface |
||
9 | */ |
||
10 | interface MessageInterface |
||
11 | { |
||
12 | /** |
||
13 | * Get a string representation of the message |
||
14 | * |
||
15 | * @return string |
||
16 | */ |
||
17 | public function __toString(); |
||
18 | |||
19 | /** |
||
20 | * Get the HTTP protocol version of the message |
||
21 | * |
||
22 | * @return string |
||
23 | */ |
||
24 | public function getProtocolVersion(); |
||
25 | |||
26 | /** |
||
27 | * Sets the body of the message. |
||
28 | * |
||
29 | * The body MUST be a StreamInterface object. Setting the body to null MUST |
||
30 | * remove the existing body. |
||
31 | * |
||
32 | * @param StreamInterface|null $body Body. |
||
33 | * |
||
34 | * @return self Returns the message. |
||
35 | */ |
||
36 | public function setBody(StreamInterface $body = null); |
||
37 | |||
38 | /** |
||
39 | * Get the body of the message |
||
40 | * |
||
41 | * @return StreamInterface|null |
||
42 | */ |
||
43 | public function getBody(); |
||
44 | |||
45 | /** |
||
46 | * Gets all message headers. |
||
47 | * |
||
48 | * The keys represent the header name as it will be sent over the wire, and |
||
49 | * each value is an array of strings associated with the header. |
||
50 | * |
||
51 | * // Represent the headers as a string |
||
52 | * foreach ($message->getHeaders() as $name => $values) { |
||
53 | * echo $name . ": " . implode(", ", $values); |
||
54 | * } |
||
55 | * |
||
56 | * @return array Returns an associative array of the message's headers. |
||
57 | */ |
||
58 | public function getHeaders(); |
||
59 | |||
60 | /** |
||
61 | * Retrieve a header by the given case-insensitive name. |
||
62 | * |
||
63 | * By default, this method returns all of the header values of the given |
||
64 | * case-insensitive header name as a string concatenated together using |
||
65 | * a comma. Because some header should not be concatenated together using a |
||
66 | * comma, this method provides a Boolean argument that can be used to |
||
67 | * retrieve the associated header values as an array of strings. |
||
68 | * |
||
69 | * @param string $header Case-insensitive header name. |
||
70 | * @param bool $asArray Set to true to retrieve the header value as an |
||
71 | * array of strings. |
||
72 | * |
||
73 | * @return array|string |
||
74 | */ |
||
75 | public function getHeader($header, $asArray = false); |
||
76 | |||
77 | /** |
||
78 | * Checks if a header exists by the given case-insensitive name. |
||
79 | * |
||
80 | * @param string $header Case-insensitive header name. |
||
81 | * |
||
82 | * @return bool Returns true if any header names match the given header |
||
83 | * name using a case-insensitive string comparison. Returns false if |
||
84 | * no matching header name is found in the message. |
||
85 | */ |
||
86 | public function hasHeader($header); |
||
87 | |||
88 | /** |
||
89 | * Remove a specific header by case-insensitive name. |
||
90 | * |
||
91 | * @param string $header Case-insensitive header name. |
||
92 | * |
||
93 | * @return self |
||
94 | */ |
||
95 | public function removeHeader($header); |
||
96 | |||
97 | /** |
||
98 | * Appends a header value to any existing values associated with the |
||
99 | * given header name. |
||
100 | * |
||
101 | * @param string $header Header name to add |
||
102 | * @param string $value Value of the header |
||
103 | * |
||
104 | * @return self |
||
105 | */ |
||
106 | public function addHeader($header, $value); |
||
107 | |||
108 | /** |
||
109 | * Merges in an associative array of headers. |
||
110 | * |
||
111 | * Each array key MUST be a string representing the case-insensitive name |
||
112 | * of a header. Each value MUST be either a string or an array of strings. |
||
113 | * For each value, the value is appended to any existing header of the same |
||
114 | * name, or, if a header does not already exist by the given name, then the |
||
115 | * header is added. |
||
116 | * |
||
117 | * @param array $headers Associative array of headers to add to the message |
||
118 | * |
||
119 | * @return self |
||
120 | */ |
||
121 | public function addHeaders(array $headers); |
||
122 | |||
123 | /** |
||
124 | * Sets a header, replacing any existing values of any headers with the |
||
125 | * same case-insensitive name. |
||
126 | * |
||
127 | * The header values MUST be a string or an array of strings. |
||
128 | * |
||
129 | * @param string $header Header name |
||
130 | * @param string|array $value Header value(s) |
||
131 | * |
||
132 | * @return self Returns the message. |
||
133 | */ |
||
134 | public function setHeader($header, $value); |
||
135 | |||
136 | /** |
||
137 | * Sets headers, replacing any headers that have already been set on the |
||
138 | * message. |
||
139 | * |
||
140 | * The array keys MUST be a string. The array values must be either a |
||
141 | * string or an array of strings. |
||
142 | * |
||
143 | * @param array $headers Headers to set. |
||
144 | * |
||
145 | * @return self Returns the message. |
||
146 | */ |
||
147 | public function setHeaders(array $headers); |
||
148 | } |