Skip to content

Commit 82b4bcb

Browse files
author
Phil Sturgeon
committed
Updated with recent feedback
1 parent de11de6 commit 82b4bcb

File tree

4 files changed

+54
-22
lines changed

4 files changed

+54
-22
lines changed

src/MessageInterface.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
interface MessageInterface
1010
{
1111
/**
12-
* Gets the HTTP protocol version as a string containing only the HTTP
13-
* version (e.g., "1.1", "1.0").
12+
* Gets the HTTP protocol version as a string.
13+
*
14+
* The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
1415
*
1516
* @return string HTTP protocol version.
1617
*/
@@ -32,6 +33,8 @@ public function getBody();
3233
* @param StreamInterface|null $body Body.
3334
*
3435
* @return void
36+
*
37+
* @throws \InvalidArgumentException When the body is not valid.
3538
*/
3639
public function setBody(StreamInterface $body = null);
3740

@@ -75,31 +78,30 @@ public function hasHeader($header);
7578
public function getHeader($header);
7679

7780
/**
78-
* Retrieve a header by the given case-insensitive name as an array of
79-
* strings.
81+
* Retrieves a header by the given case-insensitive name as an array of strings.
8082
*
8183
* @param string $header Case-insensitive header name.
8284
*
83-
* @return array
85+
* @return string[]
8486
*/
8587
public function getHeaderAsArray($header);
8688

8789
/**
8890
* Sets a header, replacing any existing values of any headers with the
8991
* same case-insensitive name.
9092
*
91-
* The header values MUST be a string or an array of strings.
93+
* The header name is case-insensitive. The header values MUST be a string
94+
* or an array of strings.
9295
*
93-
* @param string $header Header name
94-
* @param string|array $value Header value(s)
96+
* @param string $header Header name
97+
* @param string|string[] $value Header value(s)
9598
*
9699
* @return void
97100
*/
98101
public function setHeader($header, $value);
99102

100103
/**
101-
* Sets headers, replacing any headers that have already been set on the
102-
* message.
104+
* Sets headers, replacing any headers that have already been set on the message.
103105
*
104106
* The array keys MUST be a string. The array values must be either a
105107
* string or an array of strings.
@@ -111,8 +113,10 @@ public function setHeader($header, $value);
111113
public function setHeaders(array $headers);
112114

113115
/**
114-
* Appends a header value to any existing values associated with the
115-
* given header name.
116+
* Appends a header value for the specified header.
117+
*
118+
* Existing values for the specified header will be maintained. The new
119+
* value will be appended to the existing list.
116120
*
117121
* @param string $header Header name to add
118122
* @param string $value Value of the header

src/RequestInterface.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ interface RequestInterface extends MessageInterface
1616
public function getMethod();
1717

1818
/**
19-
* Sets the method to be performed on the resource identified by the
20-
* Request-URI.
19+
* Sets the method to be performed on the resource identified by the Request-URI.
2120
*
2221
* While HTTP method names are typically all uppercase characters, HTTP
2322
* method names are case-sensitive and thus implementations SHOULD NOT
@@ -32,7 +31,11 @@ public function setMethod($method);
3231
/**
3332
* Gets the absolute request URL.
3433
*
35-
* @return string Returns the URL as a string.
34+
* @return string|object Returns the URL as a string, or an object that
35+
* implements the `__toString()` method. The URL must be an absolute URI
36+
* as specified in RFC 3986.
37+
*
38+
* @link http://tools.ietf.org/html/rfc3986#section-4.3
3639
*/
3740
public function getUrl();
3841

@@ -43,9 +46,10 @@ public function getUrl();
4346
* `__toString()` method. The URL must be an absolute URI as specified
4447
* in RFC 3986.
4548
*
46-
* @param string $url Request URL.
49+
* @param string|object $url Request URL.
4750
*
4851
* @return void
52+
*
4953
* @throws \InvalidArgumentException If the URL is invalid.
5054
* @link http://tools.ietf.org/html/rfc3986#section-4.3
5155
*/

src/ResponseInterface.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@
99
interface ResponseInterface extends MessageInterface
1010
{
1111
/**
12-
* Gets the response Status-Code, a 3-digit integer result code of the
13-
* server's attempt to understand and satisfy the request.
12+
* Gets the response Status-Code.
13+
*
14+
* The Status-Code is a 3-digit integer result code of the server's attempt
15+
* to understand and satisfy the request.
1416
*
1517
* @return integer Status code.
1618
*/
1719
public function getStatusCode();
1820

1921
/**
20-
* Gets the response Reason-Phrase, a short textual description of the
21-
* Status-Code.
22+
* Sets the status code of this response.
23+
*
24+
* @param integer $code The 3-digit integer result code to set.
25+
*/
26+
public function setStatusCode($code);
27+
28+
/**
29+
* Gets the response Reason-Phrase, a short textual description of the Status-Code.
2230
*
2331
* Because a Reason-Phrase is not a required element in response
2432
* Status-Line, the Reason-Phrase value MAY be null. Implementations MAY
@@ -28,4 +36,14 @@ public function getStatusCode();
2836
* @return string|null Reason phrase, or null if unknown.
2937
*/
3038
public function getReasonPhrase();
39+
40+
/**
41+
* Sets the Reason-Phrase of the response.
42+
*
43+
* If no Reason-Phrase is specified, implementations MAY choose to default
44+
* to the RFC 2616 recommended reason phrase for the response's Status-Code.
45+
*
46+
* @param string $phrase The Reason-Phrase to set.
47+
*/
48+
public function setReasonPhrase($phrase);
3149
}

src/StreamInterface.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
interface StreamInterface
99
{
1010
/**
11-
* Attempts to seek to the beginning of the stream and reads all data into
12-
* a string until the end of the stream is reached.
11+
* Reads all data from the stream into a string, from the beginning to end.
12+
*
13+
* This method MUST attempt to seek to the beginning of the stream before
14+
* reading data and read the stream until the end is reached.
1315
*
1416
* Warning: This could attempt to load a large amount of data into memory.
1517
*
@@ -19,13 +21,17 @@ public function __toString();
1921

2022
/**
2123
* Closes the stream and any underlying resources.
24+
*
25+
* @return void
2226
*/
2327
public function close();
2428

2529
/**
2630
* Separates any underlying resources from the stream.
2731
*
2832
* After the stream has been detached, the stream is in an unusable state.
33+
*
34+
* @return void
2935
*/
3036
public function detach();
3137

0 commit comments

Comments
 (0)