AuthorityInterface.php
2 years ago
DataPathInterface.php
2 years ago
DomainHostInterface.php
2 years ago
FragmentInterface.php
2 years ago
HostInterface.php
2 years ago
IpHostInterface.php
2 years ago
PathInterface.php
2 years ago
PortInterface.php
2 years ago
QueryInterface.php
2 years ago
SegmentedPathInterface.php
2 years ago
UriComponentInterface.php
2 years ago
UriException.php
2 years ago
UriInterface.php
2 years ago
UserInfoInterface.php
2 years ago
UriInterface.php
275 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * League.Uri (https://uri.thephpleague.com) |
| 5 | * |
| 6 | * (c) Ignace Nyamagana Butera <nyamsprod@gmail.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | declare (strict_types=1); |
| 12 | namespace IAWPSCOPED\League\Uri\Contracts; |
| 13 | |
| 14 | use IAWPSCOPED\League\Uri\Exceptions\IdnSupportMissing; |
| 15 | use IAWPSCOPED\League\Uri\Exceptions\SyntaxError; |
| 16 | /** @internal */ |
| 17 | interface UriInterface extends \JsonSerializable |
| 18 | { |
| 19 | /** |
| 20 | * Returns the string representation as a URI reference. |
| 21 | * |
| 22 | * @see http://tools.ietf.org/html/rfc3986#section-4.1 |
| 23 | */ |
| 24 | public function __toString() : string; |
| 25 | /** |
| 26 | * Returns the string representation as a URI reference. |
| 27 | * |
| 28 | * @see http://tools.ietf.org/html/rfc3986#section-4.1 |
| 29 | * @see ::__toString |
| 30 | */ |
| 31 | public function jsonSerialize() : string; |
| 32 | /** |
| 33 | * Retrieve the scheme component of the URI. |
| 34 | * |
| 35 | * If no scheme is present, this method MUST return a null value. |
| 36 | * |
| 37 | * The value returned MUST be normalized to lowercase, per RFC 3986 |
| 38 | * Section 3.1. |
| 39 | * |
| 40 | * The trailing ":" character is not part of the scheme and MUST NOT be |
| 41 | * added. |
| 42 | * |
| 43 | * @see https://tools.ietf.org/html/rfc3986#section-3.1 |
| 44 | */ |
| 45 | public function getScheme() : ?string; |
| 46 | /** |
| 47 | * Retrieve the authority component of the URI. |
| 48 | * |
| 49 | * If no scheme is present, this method MUST return a null value. |
| 50 | * |
| 51 | * If the port component is not set or is the standard port for the current |
| 52 | * scheme, it SHOULD NOT be included. |
| 53 | * |
| 54 | * @see https://tools.ietf.org/html/rfc3986#section-3.2 |
| 55 | */ |
| 56 | public function getAuthority() : ?string; |
| 57 | /** |
| 58 | * Retrieve the user information component of the URI. |
| 59 | * |
| 60 | * If no scheme is present, this method MUST return a null value. |
| 61 | * |
| 62 | * If a user is present in the URI, this will return that value; |
| 63 | * additionally, if the password is also present, it will be appended to the |
| 64 | * user value, with a colon (":") separating the values. |
| 65 | * |
| 66 | * The trailing "@" character is not part of the user information and MUST |
| 67 | * NOT be added. |
| 68 | */ |
| 69 | public function getUserInfo() : ?string; |
| 70 | /** |
| 71 | * Retrieve the host component of the URI. |
| 72 | * |
| 73 | * If no host is present this method MUST return a null value. |
| 74 | * |
| 75 | * The value returned MUST be normalized to lowercase, per RFC 3986 |
| 76 | * Section 3.2.2. |
| 77 | * |
| 78 | * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 |
| 79 | */ |
| 80 | public function getHost() : ?string; |
| 81 | /** |
| 82 | * Retrieve the port component of the URI. |
| 83 | * |
| 84 | * If a port is present, and it is non-standard for the current scheme, |
| 85 | * this method MUST return it as an integer. If the port is the standard port |
| 86 | * used with the current scheme, this method SHOULD return null. |
| 87 | * |
| 88 | * If no port is present, and no scheme is present, this method MUST return |
| 89 | * a null value. |
| 90 | * |
| 91 | * If no port is present, but a scheme is present, this method MAY return |
| 92 | * the standard port for that scheme, but SHOULD return null. |
| 93 | */ |
| 94 | public function getPort() : ?int; |
| 95 | /** |
| 96 | * Retrieve the path component of the URI. |
| 97 | * |
| 98 | * The path can either be empty or absolute (starting with a slash) or |
| 99 | * rootless (not starting with a slash). Implementations MUST support all |
| 100 | * three syntaxes. |
| 101 | * |
| 102 | * Normally, the empty path "" and absolute path "/" are considered equal as |
| 103 | * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically |
| 104 | * do this normalization because in contexts with a trimmed base path, e.g. |
| 105 | * the front controller, this difference becomes significant. It's the task |
| 106 | * of the user to handle both "" and "/". |
| 107 | * |
| 108 | * The value returned MUST be percent-encoded, but MUST NOT double-encode |
| 109 | * any characters. To determine what characters to encode, please refer to |
| 110 | * RFC 3986, Sections 2 and 3.3. |
| 111 | * |
| 112 | * As an example, if the value should include a slash ("/") not intended as |
| 113 | * delimiter between path segments, that value MUST be passed in encoded |
| 114 | * form (e.g., "%2F") to the instance. |
| 115 | * |
| 116 | * @see https://tools.ietf.org/html/rfc3986#section-2 |
| 117 | * @see https://tools.ietf.org/html/rfc3986#section-3.3 |
| 118 | */ |
| 119 | public function getPath() : string; |
| 120 | /** |
| 121 | * Retrieve the query string of the URI. |
| 122 | * |
| 123 | * If no host is present this method MUST return a null value. |
| 124 | * |
| 125 | * The leading "?" character is not part of the query and MUST NOT be |
| 126 | * added. |
| 127 | * |
| 128 | * The value returned MUST be percent-encoded, but MUST NOT double-encode |
| 129 | * any characters. To determine what characters to encode, please refer to |
| 130 | * RFC 3986, Sections 2 and 3.4. |
| 131 | * |
| 132 | * As an example, if a value in a key/value pair of the query string should |
| 133 | * include an ampersand ("&") not intended as a delimiter between values, |
| 134 | * that value MUST be passed in encoded form (e.g., "%26") to the instance. |
| 135 | * |
| 136 | * @see https://tools.ietf.org/html/rfc3986#section-2 |
| 137 | * @see https://tools.ietf.org/html/rfc3986#section-3.4 |
| 138 | */ |
| 139 | public function getQuery() : ?string; |
| 140 | /** |
| 141 | * Retrieve the fragment component of the URI. |
| 142 | * |
| 143 | * If no host is present this method MUST return a null value. |
| 144 | * |
| 145 | * The leading "#" character is not part of the fragment and MUST NOT be |
| 146 | * added. |
| 147 | * |
| 148 | * The value returned MUST be percent-encoded, but MUST NOT double-encode |
| 149 | * any characters. To determine what characters to encode, please refer to |
| 150 | * RFC 3986, Sections 2 and 3.5. |
| 151 | * |
| 152 | * @see https://tools.ietf.org/html/rfc3986#section-2 |
| 153 | * @see https://tools.ietf.org/html/rfc3986#section-3.5 |
| 154 | */ |
| 155 | public function getFragment() : ?string; |
| 156 | /** |
| 157 | * Return an instance with the specified scheme. |
| 158 | * |
| 159 | * This method MUST retain the state of the current instance, and return |
| 160 | * an instance that contains the specified scheme. |
| 161 | * |
| 162 | * A null value provided for the scheme is equivalent to removing the scheme |
| 163 | * information. |
| 164 | * |
| 165 | * @param ?string $scheme |
| 166 | * |
| 167 | * @throws SyntaxError for invalid component or transformations |
| 168 | * that would result in a object in invalid state. |
| 169 | */ |
| 170 | public function withScheme(?string $scheme) : self; |
| 171 | /** |
| 172 | * Return an instance with the specified user information. |
| 173 | * |
| 174 | * This method MUST retain the state of the current instance, and return |
| 175 | * an instance that contains the specified user information. |
| 176 | * |
| 177 | * Password is optional, but the user information MUST include the |
| 178 | * user; a null value for the user is equivalent to removing user |
| 179 | * information. |
| 180 | * |
| 181 | * @param ?string $user |
| 182 | * @param ?string $password |
| 183 | * |
| 184 | * @throws SyntaxError for invalid component or transformations |
| 185 | * that would result in a object in invalid state. |
| 186 | */ |
| 187 | public function withUserInfo(?string $user, ?string $password = null) : self; |
| 188 | /** |
| 189 | * Return an instance with the specified host. |
| 190 | * |
| 191 | * This method MUST retain the state of the current instance, and return |
| 192 | * an instance that contains the specified host. |
| 193 | * |
| 194 | * A null value provided for the host is equivalent to removing the host |
| 195 | * information. |
| 196 | * |
| 197 | * @param ?string $host |
| 198 | * |
| 199 | * @throws SyntaxError for invalid component or transformations |
| 200 | * that would result in a object in invalid state. |
| 201 | * @throws IdnSupportMissing for component or transformations |
| 202 | * requiring IDN support when IDN support is not present |
| 203 | * or misconfigured. |
| 204 | */ |
| 205 | public function withHost(?string $host) : self; |
| 206 | /** |
| 207 | * Return an instance with the specified port. |
| 208 | * |
| 209 | * This method MUST retain the state of the current instance, and return |
| 210 | * an instance that contains the specified port. |
| 211 | * |
| 212 | * A null value provided for the port is equivalent to removing the port |
| 213 | * information. |
| 214 | * |
| 215 | * @param ?int $port |
| 216 | * |
| 217 | * @throws SyntaxError for invalid component or transformations |
| 218 | * that would result in a object in invalid state. |
| 219 | */ |
| 220 | public function withPort(?int $port) : self; |
| 221 | /** |
| 222 | * Return an instance with the specified path. |
| 223 | * |
| 224 | * This method MUST retain the state of the current instance, and return |
| 225 | * an instance that contains the specified path. |
| 226 | * |
| 227 | * The path can either be empty or absolute (starting with a slash) or |
| 228 | * rootless (not starting with a slash). Implementations MUST support all |
| 229 | * three syntaxes. |
| 230 | * |
| 231 | * Users can provide both encoded and decoded path characters. |
| 232 | * Implementations ensure the correct encoding as outlined in getPath(). |
| 233 | * |
| 234 | * @throws SyntaxError for invalid component or transformations |
| 235 | * that would result in a object in invalid state. |
| 236 | */ |
| 237 | public function withPath(string $path) : self; |
| 238 | /** |
| 239 | * Return an instance with the specified query string. |
| 240 | * |
| 241 | * This method MUST retain the state of the current instance, and return |
| 242 | * an instance that contains the specified query string. |
| 243 | * |
| 244 | * Users can provide both encoded and decoded query characters. |
| 245 | * Implementations ensure the correct encoding as outlined in getQuery(). |
| 246 | * |
| 247 | * A null value provided for the query is equivalent to removing the query |
| 248 | * information. |
| 249 | * |
| 250 | * @param ?string $query |
| 251 | * |
| 252 | * @throws SyntaxError for invalid component or transformations |
| 253 | * that would result in a object in invalid state. |
| 254 | */ |
| 255 | public function withQuery(?string $query) : self; |
| 256 | /** |
| 257 | * Return an instance with the specified URI fragment. |
| 258 | * |
| 259 | * This method MUST retain the state of the current instance, and return |
| 260 | * an instance that contains the specified URI fragment. |
| 261 | * |
| 262 | * Users can provide both encoded and decoded fragment characters. |
| 263 | * Implementations ensure the correct encoding as outlined in getFragment(). |
| 264 | * |
| 265 | * A null value provided for the fragment is equivalent to removing the fragment |
| 266 | * information. |
| 267 | * |
| 268 | * @param ?string $fragment |
| 269 | * |
| 270 | * @throws SyntaxError for invalid component or transformations |
| 271 | * that would result in a object in invalid state. |
| 272 | */ |
| 273 | public function withFragment(?string $fragment) : self; |
| 274 | } |
| 275 |