Chris@0: 80, Chris@0: 'https' => 443, Chris@0: 'ftp' => 21, Chris@0: 'gopher' => 70, Chris@0: 'nntp' => 119, Chris@0: 'news' => 119, Chris@0: 'telnet' => 23, Chris@0: 'tn3270' => 23, Chris@0: 'imap' => 143, Chris@0: 'pop' => 110, Chris@0: 'ldap' => 389, Chris@0: ]; Chris@0: Chris@0: private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; Chris@0: private static $charSubDelims = '!\$&\'\(\)\*\+,;='; Chris@0: private static $replaceQuery = ['=' => '%3D', '&' => '%26']; Chris@0: Chris@0: /** @var string Uri scheme. */ Chris@0: private $scheme = ''; Chris@0: Chris@0: /** @var string Uri user info. */ Chris@0: private $userInfo = ''; Chris@0: Chris@0: /** @var string Uri host. */ Chris@0: private $host = ''; Chris@0: Chris@0: /** @var int|null Uri port. */ Chris@0: private $port; Chris@0: Chris@0: /** @var string Uri path. */ Chris@0: private $path = ''; Chris@0: Chris@0: /** @var string Uri query string. */ Chris@0: private $query = ''; Chris@0: Chris@0: /** @var string Uri fragment. */ Chris@0: private $fragment = ''; Chris@0: Chris@0: /** Chris@0: * @param string $uri URI to parse Chris@0: */ Chris@0: public function __construct($uri = '') Chris@0: { Chris@0: // weak type check to also accept null until we can add scalar type hints Chris@0: if ($uri != '') { Chris@0: $parts = parse_url($uri); Chris@0: if ($parts === false) { Chris@0: throw new \InvalidArgumentException("Unable to parse URI: $uri"); Chris@0: } Chris@0: $this->applyParts($parts); Chris@0: } Chris@0: } Chris@0: Chris@0: public function __toString() Chris@0: { Chris@0: return self::composeComponents( Chris@0: $this->scheme, Chris@0: $this->getAuthority(), Chris@0: $this->path, Chris@0: $this->query, Chris@0: $this->fragment Chris@0: ); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Composes a URI reference string from its various components. Chris@0: * Chris@0: * Usually this method does not need to be called manually but instead is used indirectly via Chris@0: * `Psr\Http\Message\UriInterface::__toString`. Chris@0: * Chris@0: * PSR-7 UriInterface treats an empty component the same as a missing component as Chris@0: * getQuery(), getFragment() etc. always return a string. This explains the slight Chris@0: * difference to RFC 3986 Section 5.3. Chris@0: * Chris@0: * Another adjustment is that the authority separator is added even when the authority is missing/empty Chris@0: * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with Chris@0: * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But Chris@0: * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to Chris@0: * that format). Chris@0: * Chris@0: * @param string $scheme Chris@0: * @param string $authority Chris@0: * @param string $path Chris@0: * @param string $query Chris@0: * @param string $fragment Chris@0: * Chris@0: * @return string Chris@0: * Chris@0: * @link https://tools.ietf.org/html/rfc3986#section-5.3 Chris@0: */ Chris@0: public static function composeComponents($scheme, $authority, $path, $query, $fragment) Chris@0: { Chris@0: $uri = ''; Chris@0: Chris@0: // weak type checks to also accept null until we can add scalar type hints Chris@0: if ($scheme != '') { Chris@0: $uri .= $scheme . ':'; Chris@0: } Chris@0: Chris@0: if ($authority != ''|| $scheme === 'file') { Chris@0: $uri .= '//' . $authority; Chris@0: } Chris@0: Chris@0: $uri .= $path; Chris@0: Chris@0: if ($query != '') { Chris@0: $uri .= '?' . $query; Chris@0: } Chris@0: Chris@0: if ($fragment != '') { Chris@0: $uri .= '#' . $fragment; Chris@0: } Chris@0: Chris@0: return $uri; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Whether the URI has the default port of the current scheme. Chris@0: * Chris@0: * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used Chris@0: * independently of the implementation. Chris@0: * Chris@0: * @param UriInterface $uri Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public static function isDefaultPort(UriInterface $uri) Chris@0: { Chris@0: return $uri->getPort() === null Chris@0: || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Whether the URI is absolute, i.e. it has a scheme. Chris@0: * Chris@0: * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true Chris@0: * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative Chris@0: * to another URI, the base URI. Relative references can be divided into several forms: Chris@0: * - network-path references, e.g. '//example.com/path' Chris@0: * - absolute-path references, e.g. '/path' Chris@0: * - relative-path references, e.g. 'subpath' Chris@0: * Chris@0: * @param UriInterface $uri Chris@0: * Chris@0: * @return bool Chris@0: * @see Uri::isNetworkPathReference Chris@0: * @see Uri::isAbsolutePathReference Chris@0: * @see Uri::isRelativePathReference Chris@0: * @link https://tools.ietf.org/html/rfc3986#section-4 Chris@0: */ Chris@0: public static function isAbsolute(UriInterface $uri) Chris@0: { Chris@0: return $uri->getScheme() !== ''; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Whether the URI is a network-path reference. Chris@0: * Chris@0: * A relative reference that begins with two slash characters is termed an network-path reference. Chris@0: * Chris@0: * @param UriInterface $uri Chris@0: * Chris@0: * @return bool Chris@0: * @link https://tools.ietf.org/html/rfc3986#section-4.2 Chris@0: */ Chris@0: public static function isNetworkPathReference(UriInterface $uri) Chris@0: { Chris@0: return $uri->getScheme() === '' && $uri->getAuthority() !== ''; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Whether the URI is a absolute-path reference. Chris@0: * Chris@0: * A relative reference that begins with a single slash character is termed an absolute-path reference. Chris@0: * Chris@0: * @param UriInterface $uri Chris@0: * Chris@0: * @return bool Chris@0: * @link https://tools.ietf.org/html/rfc3986#section-4.2 Chris@0: */ Chris@0: public static function isAbsolutePathReference(UriInterface $uri) Chris@0: { Chris@0: return $uri->getScheme() === '' Chris@0: && $uri->getAuthority() === '' Chris@0: && isset($uri->getPath()[0]) Chris@0: && $uri->getPath()[0] === '/'; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Whether the URI is a relative-path reference. Chris@0: * Chris@0: * A relative reference that does not begin with a slash character is termed a relative-path reference. Chris@0: * Chris@0: * @param UriInterface $uri Chris@0: * Chris@0: * @return bool Chris@0: * @link https://tools.ietf.org/html/rfc3986#section-4.2 Chris@0: */ Chris@0: public static function isRelativePathReference(UriInterface $uri) Chris@0: { Chris@0: return $uri->getScheme() === '' Chris@0: && $uri->getAuthority() === '' Chris@0: && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Whether the URI is a same-document reference. Chris@0: * Chris@0: * A same-document reference refers to a URI that is, aside from its fragment Chris@0: * component, identical to the base URI. When no base URI is given, only an empty Chris@0: * URI reference (apart from its fragment) is considered a same-document reference. Chris@0: * Chris@0: * @param UriInterface $uri The URI to check Chris@0: * @param UriInterface|null $base An optional base URI to compare against Chris@0: * Chris@0: * @return bool Chris@0: * @link https://tools.ietf.org/html/rfc3986#section-4.4 Chris@0: */ Chris@0: public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) Chris@0: { Chris@0: if ($base !== null) { Chris@0: $uri = UriResolver::resolve($base, $uri); Chris@0: Chris@0: return ($uri->getScheme() === $base->getScheme()) Chris@0: && ($uri->getAuthority() === $base->getAuthority()) Chris@0: && ($uri->getPath() === $base->getPath()) Chris@0: && ($uri->getQuery() === $base->getQuery()); Chris@0: } Chris@0: Chris@0: return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Removes dot segments from a path and returns the new path. Chris@0: * Chris@0: * @param string $path Chris@0: * Chris@0: * @return string Chris@0: * Chris@0: * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. Chris@0: * @see UriResolver::removeDotSegments Chris@0: */ Chris@0: public static function removeDotSegments($path) Chris@0: { Chris@0: return UriResolver::removeDotSegments($path); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Converts the relative URI into a new URI that is resolved against the base URI. Chris@0: * Chris@0: * @param UriInterface $base Base URI Chris@0: * @param string|UriInterface $rel Relative URI Chris@0: * Chris@0: * @return UriInterface Chris@0: * Chris@0: * @deprecated since version 1.4. Use UriResolver::resolve instead. Chris@0: * @see UriResolver::resolve Chris@0: */ Chris@0: public static function resolve(UriInterface $base, $rel) Chris@0: { Chris@0: if (!($rel instanceof UriInterface)) { Chris@0: $rel = new self($rel); Chris@0: } Chris@0: Chris@0: return UriResolver::resolve($base, $rel); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Creates a new URI with a specific query string value removed. Chris@0: * Chris@0: * Any existing query string values that exactly match the provided key are Chris@0: * removed. Chris@0: * Chris@0: * @param UriInterface $uri URI to use as a base. Chris@0: * @param string $key Query string key to remove. Chris@0: * Chris@0: * @return UriInterface Chris@0: */ Chris@0: public static function withoutQueryValue(UriInterface $uri, $key) Chris@0: { Chris@17: $result = self::getFilteredQueryString($uri, [$key]); Chris@0: Chris@0: return $uri->withQuery(implode('&', $result)); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Creates a new URI with a specific query string value. Chris@0: * Chris@0: * Any existing query string values that exactly match the provided key are Chris@0: * removed and replaced with the given key value pair. Chris@0: * Chris@0: * A value of null will set the query string key without a value, e.g. "key" Chris@0: * instead of "key=value". Chris@0: * Chris@0: * @param UriInterface $uri URI to use as a base. Chris@0: * @param string $key Key to set. Chris@0: * @param string|null $value Value to set Chris@0: * Chris@0: * @return UriInterface Chris@0: */ Chris@0: public static function withQueryValue(UriInterface $uri, $key, $value) Chris@0: { Chris@17: $result = self::getFilteredQueryString($uri, [$key]); Chris@0: Chris@17: $result[] = self::generateQueryString($key, $value); Chris@0: Chris@17: return $uri->withQuery(implode('&', $result)); Chris@17: } Chris@0: Chris@17: /** Chris@17: * Creates a new URI with multiple specific query string values. Chris@17: * Chris@17: * It has the same behavior as withQueryValue() but for an associative array of key => value. Chris@17: * Chris@17: * @param UriInterface $uri URI to use as a base. Chris@17: * @param array $keyValueArray Associative array of key and values Chris@17: * Chris@17: * @return UriInterface Chris@17: */ Chris@17: public static function withQueryValues(UriInterface $uri, array $keyValueArray) Chris@17: { Chris@17: $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); Chris@17: Chris@17: foreach ($keyValueArray as $key => $value) { Chris@17: $result[] = self::generateQueryString($key, $value); Chris@0: } Chris@0: Chris@0: return $uri->withQuery(implode('&', $result)); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Creates a URI from a hash of `parse_url` components. Chris@0: * Chris@0: * @param array $parts Chris@0: * Chris@0: * @return UriInterface Chris@0: * @link http://php.net/manual/en/function.parse-url.php Chris@0: * Chris@0: * @throws \InvalidArgumentException If the components do not form a valid URI. Chris@0: */ Chris@0: public static function fromParts(array $parts) Chris@0: { Chris@0: $uri = new self(); Chris@0: $uri->applyParts($parts); Chris@0: $uri->validateState(); Chris@0: Chris@0: return $uri; Chris@0: } Chris@0: Chris@0: public function getScheme() Chris@0: { Chris@0: return $this->scheme; Chris@0: } Chris@0: Chris@0: public function getAuthority() Chris@0: { Chris@0: $authority = $this->host; Chris@0: if ($this->userInfo !== '') { Chris@0: $authority = $this->userInfo . '@' . $authority; Chris@0: } Chris@0: Chris@0: if ($this->port !== null) { Chris@0: $authority .= ':' . $this->port; Chris@0: } Chris@0: Chris@0: return $authority; Chris@0: } Chris@0: Chris@0: public function getUserInfo() Chris@0: { Chris@0: return $this->userInfo; Chris@0: } Chris@0: Chris@0: public function getHost() Chris@0: { Chris@0: return $this->host; Chris@0: } Chris@0: Chris@0: public function getPort() Chris@0: { Chris@0: return $this->port; Chris@0: } Chris@0: Chris@0: public function getPath() Chris@0: { Chris@0: return $this->path; Chris@0: } Chris@0: Chris@0: public function getQuery() Chris@0: { Chris@0: return $this->query; Chris@0: } Chris@0: Chris@0: public function getFragment() Chris@0: { Chris@0: return $this->fragment; Chris@0: } Chris@0: Chris@0: public function withScheme($scheme) Chris@0: { Chris@0: $scheme = $this->filterScheme($scheme); Chris@0: Chris@0: if ($this->scheme === $scheme) { Chris@0: return $this; Chris@0: } Chris@0: Chris@0: $new = clone $this; Chris@0: $new->scheme = $scheme; Chris@0: $new->removeDefaultPort(); Chris@0: $new->validateState(); Chris@0: Chris@0: return $new; Chris@0: } Chris@0: Chris@0: public function withUserInfo($user, $password = null) Chris@0: { Chris@0: $info = $user; Chris@0: if ($password != '') { Chris@0: $info .= ':' . $password; Chris@0: } Chris@0: Chris@0: if ($this->userInfo === $info) { Chris@0: return $this; Chris@0: } Chris@0: Chris@0: $new = clone $this; Chris@0: $new->userInfo = $info; Chris@0: $new->validateState(); Chris@0: Chris@0: return $new; Chris@0: } Chris@0: Chris@0: public function withHost($host) Chris@0: { Chris@0: $host = $this->filterHost($host); Chris@0: Chris@0: if ($this->host === $host) { Chris@0: return $this; Chris@0: } Chris@0: Chris@0: $new = clone $this; Chris@0: $new->host = $host; Chris@0: $new->validateState(); Chris@0: Chris@0: return $new; Chris@0: } Chris@0: Chris@0: public function withPort($port) Chris@0: { Chris@0: $port = $this->filterPort($port); Chris@0: Chris@0: if ($this->port === $port) { Chris@0: return $this; Chris@0: } Chris@0: Chris@0: $new = clone $this; Chris@0: $new->port = $port; Chris@0: $new->removeDefaultPort(); Chris@0: $new->validateState(); Chris@0: Chris@0: return $new; Chris@0: } Chris@0: Chris@0: public function withPath($path) Chris@0: { Chris@0: $path = $this->filterPath($path); Chris@0: Chris@0: if ($this->path === $path) { Chris@0: return $this; Chris@0: } Chris@0: Chris@0: $new = clone $this; Chris@0: $new->path = $path; Chris@0: $new->validateState(); Chris@0: Chris@0: return $new; Chris@0: } Chris@0: Chris@0: public function withQuery($query) Chris@0: { Chris@0: $query = $this->filterQueryAndFragment($query); Chris@0: Chris@0: if ($this->query === $query) { Chris@0: return $this; Chris@0: } Chris@0: Chris@0: $new = clone $this; Chris@0: $new->query = $query; Chris@0: Chris@0: return $new; Chris@0: } Chris@0: Chris@0: public function withFragment($fragment) Chris@0: { Chris@0: $fragment = $this->filterQueryAndFragment($fragment); Chris@0: Chris@0: if ($this->fragment === $fragment) { Chris@0: return $this; Chris@0: } Chris@0: Chris@0: $new = clone $this; Chris@0: $new->fragment = $fragment; Chris@0: Chris@0: return $new; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Apply parse_url parts to a URI. Chris@0: * Chris@0: * @param array $parts Array of parse_url parts to apply. Chris@0: */ Chris@0: private function applyParts(array $parts) Chris@0: { Chris@0: $this->scheme = isset($parts['scheme']) Chris@0: ? $this->filterScheme($parts['scheme']) Chris@0: : ''; Chris@0: $this->userInfo = isset($parts['user']) ? $parts['user'] : ''; Chris@0: $this->host = isset($parts['host']) Chris@0: ? $this->filterHost($parts['host']) Chris@0: : ''; Chris@0: $this->port = isset($parts['port']) Chris@0: ? $this->filterPort($parts['port']) Chris@0: : null; Chris@0: $this->path = isset($parts['path']) Chris@0: ? $this->filterPath($parts['path']) Chris@0: : ''; Chris@0: $this->query = isset($parts['query']) Chris@0: ? $this->filterQueryAndFragment($parts['query']) Chris@0: : ''; Chris@0: $this->fragment = isset($parts['fragment']) Chris@0: ? $this->filterQueryAndFragment($parts['fragment']) Chris@0: : ''; Chris@0: if (isset($parts['pass'])) { Chris@0: $this->userInfo .= ':' . $parts['pass']; Chris@0: } Chris@0: Chris@0: $this->removeDefaultPort(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * @param string $scheme Chris@0: * Chris@0: * @return string Chris@0: * Chris@0: * @throws \InvalidArgumentException If the scheme is invalid. Chris@0: */ Chris@0: private function filterScheme($scheme) Chris@0: { Chris@0: if (!is_string($scheme)) { Chris@0: throw new \InvalidArgumentException('Scheme must be a string'); Chris@0: } Chris@0: Chris@0: return strtolower($scheme); Chris@0: } Chris@0: Chris@0: /** Chris@0: * @param string $host Chris@0: * Chris@0: * @return string Chris@0: * Chris@0: * @throws \InvalidArgumentException If the host is invalid. Chris@0: */ Chris@0: private function filterHost($host) Chris@0: { Chris@0: if (!is_string($host)) { Chris@0: throw new \InvalidArgumentException('Host must be a string'); Chris@0: } Chris@0: Chris@0: return strtolower($host); Chris@0: } Chris@0: Chris@0: /** Chris@0: * @param int|null $port Chris@0: * Chris@0: * @return int|null Chris@0: * Chris@0: * @throws \InvalidArgumentException If the port is invalid. Chris@0: */ Chris@0: private function filterPort($port) Chris@0: { Chris@0: if ($port === null) { Chris@0: return null; Chris@0: } Chris@0: Chris@0: $port = (int) $port; Chris@0: if (1 > $port || 0xffff < $port) { Chris@0: throw new \InvalidArgumentException( Chris@0: sprintf('Invalid port: %d. Must be between 1 and 65535', $port) Chris@0: ); Chris@0: } Chris@0: Chris@0: return $port; Chris@0: } Chris@0: Chris@17: /** Chris@17: * @param UriInterface $uri Chris@17: * @param array $keys Chris@17: * Chris@17: * @return array Chris@17: */ Chris@17: private static function getFilteredQueryString(UriInterface $uri, array $keys) Chris@17: { Chris@17: $current = $uri->getQuery(); Chris@17: Chris@17: if ($current === '') { Chris@17: return []; Chris@17: } Chris@17: Chris@17: $decodedKeys = array_map('rawurldecode', $keys); Chris@17: Chris@17: return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { Chris@17: return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); Chris@17: }); Chris@17: } Chris@17: Chris@17: /** Chris@17: * @param string $key Chris@17: * @param string|null $value Chris@17: * Chris@17: * @return string Chris@17: */ Chris@17: private static function generateQueryString($key, $value) Chris@17: { Chris@17: // Query string separators ("=", "&") within the key or value need to be encoded Chris@17: // (while preventing double-encoding) before setting the query string. All other Chris@17: // chars that need percent-encoding will be encoded by withQuery(). Chris@17: $queryString = strtr($key, self::$replaceQuery); Chris@17: Chris@17: if ($value !== null) { Chris@17: $queryString .= '=' . strtr($value, self::$replaceQuery); Chris@17: } Chris@17: Chris@17: return $queryString; Chris@17: } Chris@17: Chris@0: private function removeDefaultPort() Chris@0: { Chris@0: if ($this->port !== null && self::isDefaultPort($this)) { Chris@0: $this->port = null; Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Filters the path of a URI Chris@0: * Chris@0: * @param string $path Chris@0: * Chris@0: * @return string Chris@0: * Chris@0: * @throws \InvalidArgumentException If the path is invalid. Chris@0: */ Chris@0: private function filterPath($path) Chris@0: { Chris@0: if (!is_string($path)) { Chris@0: throw new \InvalidArgumentException('Path must be a string'); Chris@0: } Chris@0: Chris@0: return preg_replace_callback( Chris@0: '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', Chris@0: [$this, 'rawurlencodeMatchZero'], Chris@0: $path Chris@0: ); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Filters the query string or fragment of a URI. Chris@0: * Chris@0: * @param string $str Chris@0: * Chris@0: * @return string Chris@0: * Chris@0: * @throws \InvalidArgumentException If the query or fragment is invalid. Chris@0: */ Chris@0: private function filterQueryAndFragment($str) Chris@0: { Chris@0: if (!is_string($str)) { Chris@0: throw new \InvalidArgumentException('Query and fragment must be a string'); Chris@0: } Chris@0: Chris@0: return preg_replace_callback( Chris@0: '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', Chris@0: [$this, 'rawurlencodeMatchZero'], Chris@0: $str Chris@0: ); Chris@0: } Chris@0: Chris@0: private function rawurlencodeMatchZero(array $match) Chris@0: { Chris@0: return rawurlencode($match[0]); Chris@0: } Chris@0: Chris@0: private function validateState() Chris@0: { Chris@0: if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { Chris@0: $this->host = self::HTTP_DEFAULT_HOST; Chris@0: } Chris@0: Chris@0: if ($this->getAuthority() === '') { Chris@0: if (0 === strpos($this->path, '//')) { Chris@0: throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); Chris@0: } Chris@0: if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { Chris@0: throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); Chris@0: } Chris@0: } elseif (isset($this->path[0]) && $this->path[0] !== '/') { Chris@0: @trigger_error( Chris@0: 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . Chris@0: 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', Chris@0: E_USER_DEPRECATED Chris@0: ); Chris@0: $this->path = '/'. $this->path; Chris@0: //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); Chris@0: } Chris@0: } Chris@0: }