composer package updates
[openemr.git] / vendor / zendframework / zend-uri / src / UriInterface.php
blobea9d03051e36e562cffd3d3bb770a75842e162df
1 <?php
2 /**
3 * @see https://github.com/zendframework/zend-uri for the canonical source repository
4 * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
5 * @license https://github.com/zendframework/zend-uri/blob/master/LICENSE.md New BSD License
6 */
8 namespace Zend\Uri;
10 /**
11 * Interface defining a URI
13 interface UriInterface
15 /**
16 * Create a new URI object
18 * @param Uri|string|null $uri
19 * @throws Exception\InvalidArgumentException
21 public function __construct($uri = null);
23 /**
24 * Check if the URI is valid
26 * Note that a relative URI may still be valid
28 * @return bool
30 public function isValid();
32 /**
33 * Check if the URI is a valid relative URI
35 * @return bool
37 public function isValidRelative();
39 /**
40 * Check if the URI is an absolute or relative URI
42 * @return bool
44 public function isAbsolute();
46 /**
47 * Parse a URI string
49 * @param string $uri
50 * @return Uri
52 public function parse($uri);
54 /**
55 * Compose the URI into a string
57 * @return string
58 * @throws Exception\InvalidUriException
60 public function toString();
62 /**
63 * Normalize the URI
65 * Normalizing a URI includes removing any redundant parent directory or
66 * current directory references from the path (e.g. foo/bar/../baz becomes
67 * foo/baz), normalizing the scheme case, decoding any over-encoded
68 * characters etc.
70 * Eventually, two normalized URLs pointing to the same resource should be
71 * equal even if they were originally represented by two different strings
73 * @return Uri
75 public function normalize();
77 /**
78 * Convert the link to a relative link by substracting a base URI
80 * This is the opposite of resolving a relative link - i.e. creating a
81 * relative reference link from an original URI and a base URI.
83 * If the two URIs do not intersect (e.g. the original URI is not in any
84 * way related to the base URI) the URI will not be modified.
86 * @param Uri|string $baseUri
87 * @return Uri
89 public function makeRelative($baseUri);
91 /**
92 * Get the scheme part of the URI
94 * @return string|null
96 public function getScheme();
98 /**
99 * Get the User-info (usually user:password) part
101 * @return string|null
103 public function getUserInfo();
106 * Get the URI host
108 * @return string|null
110 public function getHost();
113 * Get the URI port
115 * @return int|null
117 public function getPort();
120 * Get the URI path
122 * @return string|null
124 public function getPath();
127 * Get the URI query
129 * @return string|null
131 public function getQuery();
134 * Return the query string as an associative array of key => value pairs
136 * This is an extension to RFC-3986 but is quite useful when working with
137 * most common URI types
139 * @return array
141 public function getQueryAsArray();
144 * Get the URI fragment
146 * @return string|null
148 public function getFragment();
151 * Set the URI scheme
153 * If the scheme is not valid according to the generic scheme syntax or
154 * is not acceptable by the specific URI class (e.g. 'http' or 'https' are
155 * the only acceptable schemes for the Zend\Uri\Http class) an exception
156 * will be thrown.
158 * You can check if a scheme is valid before setting it using the
159 * validateScheme() method.
161 * @param string $scheme
162 * @throws Exception\InvalidUriPartException
163 * @return Uri
165 public function setScheme($scheme);
168 * Set the URI User-info part (usually user:password)
170 * @param string $userInfo
171 * @return Uri
172 * @throws Exception\InvalidUriPartException If the schema definition
173 * does not have this part
175 public function setUserInfo($userInfo);
178 * Set the URI host
180 * Note that the generic syntax for URIs allows using host names which
181 * are not necessarily IPv4 addresses or valid DNS host names. For example,
182 * IPv6 addresses are allowed as well, and also an abstract "registered name"
183 * which may be any name composed of a valid set of characters, including,
184 * for example, tilda (~) and underscore (_) which are not allowed in DNS
185 * names.
187 * Subclasses of Uri may impose more strict validation of host names - for
188 * example the HTTP RFC clearly states that only IPv4 and valid DNS names
189 * are allowed in HTTP URIs.
191 * @param string $host
192 * @throws Exception\InvalidUriPartException
193 * @return Uri
195 public function setHost($host);
198 * Set the port part of the URI
200 * @param int $port
201 * @return Uri
203 public function setPort($port);
206 * Set the path
208 * @param string $path
209 * @return Uri
211 public function setPath($path);
214 * Set the query string
216 * If an array is provided, will encode this array of parameters into a
217 * query string. Array values will be represented in the query string using
218 * PHP's common square bracket notation.
220 * @param string|array $query
221 * @return Uri
223 public function setQuery($query);
226 * Set the URI fragment part
228 * @param string $fragment
229 * @return Uri
230 * @throws Exception\InvalidUriPartException If the schema definition
231 * does not have this part
233 public function setFragment($fragment);
236 * Magic method to convert the URI to a string
238 * @return string
240 public function __toString();