Skip to content

Commit 2721ad1

Browse files
committed
Rename URI interface for clarity
While it's generally a URI, for the purposes of PSR-7, it technically represents the request target. As such, UriTargetInterface will be more clear as to its purpose, and stave off questions of "why is a relative URL considered valid?"
1 parent c898a76 commit 2721ad1

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/RequestInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ public function withMethod($method);
4747
/**
4848
* Retrieves the URI instance.
4949
*
50-
* This method MUST return a UriInterface instance.
50+
* This method MUST return a UriTargetInterface instance.
5151
*
5252
* @link http://tools.ietf.org/html/rfc3986#section-4.3
53-
* @return UriInterface Returns a UriInterface instance representing the
54-
* URI of the request, if any.
53+
* @return UriTargetInterface Returns a UriTargetInterface instance
54+
* representing the URI of the request, if any.
5555
*/
5656
public function getUri();
5757

@@ -60,11 +60,11 @@ public function getUri();
6060
*
6161
* This method MUST be implemented in such a way as to retain the
6262
* immutability of the message, and MUST return a new instance that has the
63-
* new UriInterface instance.
63+
* new UriTargetInterface instance.
6464
*
6565
* @link http://tools.ietf.org/html/rfc3986#section-4.3
66-
* @param UriInterface $uri New request URI to use.
66+
* @param UriTargetInterface $uri New request URI to use.
6767
* @return self
6868
*/
69-
public function withUri(UriInterface $uri);
69+
public function withUri(UriTargetInterface $uri);
7070
}

src/UriInterface.php renamed to src/UriTargetInterface.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@
44
/**
55
* Value object representing the request target, and typically a URI.
66
*
7-
* Instances of this interface are considered immutable; all methods that
7+
* Instances of this interface are considered immutable; all methods that
88
* might change state MUST be implemented such that they retain the internal
99
* state of the current instance and return a new instance that contains the
1010
* changed state.
1111
*
1212
* Since this interface represents a request target per RFC 7230, the instance
13-
* can potentially omit the scheme and authority. As such, test methods exist
14-
* for determining what request target form is in use:
13+
* MAY represent an absolute URI OR one of the request targets that are not
14+
* fully qualified URIs, including origin-form, authority-form, or
15+
* asterisk-form. As such, test methods exist for determining what request
16+
* target form is in use:
1517
*
16-
* - isOrigin() tests if the target is in origin-form (path + optional query
17-
* string only).
1818
* - isAbsolute() tests if the target is in absolute-form (minimally scheme +
1919
* authority).
20+
* - isOrigin() tests if the target is in origin-form (path + optional query
21+
* string only).
2022
* - isAuthority() tests if the target contains the authority only.
2123
* - isAsterisk() tests if the entirety of the target is '*'.
2224
*
2325
* These target forms are included, as they are valid forms for use with an
2426
* HTTP request, and will appear without other URI segments available within
25-
* the request line. This interface models the target as it appears.
27+
* the request line. This interface models the target as it appears in the
28+
* incoming request line or as it will be emitted by a client.
2629
*
2730
* Typically, for all forms other than absolute-form, minimally the Host header
2831
* will be also be present in the request message. For server-side requests,
@@ -31,7 +34,7 @@
3134
* @link http://tools.ietf.org/html/rfc3986 (the URI specification)
3235
* @link http://tools.ietf.org/html/rfc7230#section-2.7 (URIs as used in the HTTP specification)
3336
*/
34-
interface UriInterface
37+
interface UriTargetInterface
3538
{
3639
/**
3740
* Retrieve the URI scheme.

0 commit comments

Comments
 (0)