Skip to content

Commit 9fcf948

Browse files
committed
Updated RequestInterface to compose a UriInterface instance
1 parent dd51dcf commit 9fcf948

File tree

1 file changed

+9
-66
lines changed

1 file changed

+9
-66
lines changed

src/RequestInterface.php

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* - Protocol version
1212
* - HTTP method
13-
* - URL
13+
* - URI
1414
* - Headers
1515
* - Message body
1616
*
@@ -48,81 +48,24 @@ public function withMethod($method);
4848
/**
4949
* Retrieves the absolute URI.
5050
*
51-
* An absolute URI consists of minimally scheme and host, but can also
52-
* contain:
53-
*
54-
* - authentication (user/pass) if provided
55-
* - port (if non-standard)
56-
* - path (if any)
57-
* - query string (if present)
58-
* - fragment (if present)
59-
*
60-
* If either of the scheme or host are not present, this method MUST return
61-
* null.
51+
* This method MUST return a UriInterface instance.
6252
*
6353
* @link http://tools.ietf.org/html/rfc3986#section-4.3
64-
* @return string|null Returns the absolute URL as a string. The URL MUST
65-
* include the scheme and host; if the port is non-standard for the
66-
* scheme, the port MUST be included; authentication data MAY be
67-
* provided. If either host or scheme are missing, this method MUST
68-
* return null.
54+
* @return UriInterface Returns a UriInterface instance representing the
55+
* URI of the request, if any.
6956
*/
70-
public function getAbsoluteUri();
57+
public function getUri();
7158

7259
/**
73-
* Create a new instance with the provided absolute URI.
74-
*
75-
* The absolute URI MUST be a string, and MUST include the scheme and host.
76-
*
77-
* If the port is non-standard for the scheme, the port MUST be provided.
78-
*
79-
* Authentication data MAY be provided.
80-
*
81-
* Path, query string, and fragment are optional.
82-
*
83-
* When setting the absolute URI, the url (see getUrl() and setUrl()) MUST
84-
* be updated.
60+
* Create a new instance with the provided URI.
8561
*
8662
* This method MUST be implemented in such a way as to retain the
8763
* immutability of the message, and MUST return a new instance that has the
88-
* changed URI and updated URL.
64+
* new UriInterface instance.
8965
*
9066
* @link http://tools.ietf.org/html/rfc3986#section-4.3
91-
* @param string $uri Absolute request URI.
92-
* @return RequestInterface
93-
* @throws \InvalidArgumentException If the URI is invalid.
94-
*/
95-
public function withAbsoluteUri($uri);
96-
97-
/**
98-
* Retrieves the request URL.
99-
*
100-
* The request URL is the path and query string ONLY.
101-
*
102-
* @link http://tools.ietf.org/html/rfc7230#section-5.3
103-
* @return string Returns the URL as a string. The URL MUST be an
104-
* origin-form (path + query string), per RFC 7230 section 5.3
105-
*/
106-
public function getUrl();
107-
108-
/**
109-
* Create a new instance with the specified request URL.
110-
*
111-
* The URL MUST be a string. The URL SHOULD be an origin-form (path + query
112-
* string) per RFC 7230 section 5.3; if other URL parts are present, the
113-
* method MUST raise an exception OR remove those parts.
114-
*
115-
* When setting the URL, the absolute URI (see getAbsoluteUri() and
116-
* setAbsoluteUri()) MUST be updated.
117-
*
118-
* This method MUST be implemented in such a way as to retain the
119-
* immutability of the message, and MUST return a new instance that has the
120-
* changed URL and updated absolute URI.
121-
*
122-
* @link http://tools.ietf.org/html/rfc7230#section-5.3
123-
* @param string $url Request URL, with path and optionally query string.
67+
* @param UriInterface $uri New request URI to use.
12468
* @return RequestInterface
125-
* @throws \InvalidArgumentException If the URL is invalid.
12669
*/
127-
public function withUrl($url);
70+
public function withUri(UriInterface $uri);
12871
}

0 commit comments

Comments
 (0)