scheme = strtolower($value); return $clone; } public function getScheme() { return $this->scheme; } public function withUserInfo($user, $password = null) { $clone = clone $this; $clone->username = $user; $clone->password = $password; return $clone; } public function getUserInfo() { return $this->username . (!empty($this->password) ? ':' . rawurlencode($this->password) : '' ); } /** * @return mixed */ public function getUsername() { return $this->username; } /** * @return mixed */ public function getPassword() { return $this->password; } public function withHost($value) { $clone = clone $this; $clone->host = $value; return $clone; } public function getHost() { return $this->host; } /** * @param int|string|null $value * @return $this */ public function withPort($value) { $clone = clone $this; $clone->port = $value; return $clone; } public function getPort() { return $this->port; } public function withPath($value) { $clone = clone $this; $clone->path = $value; return $clone; } public function getPath() { return $this->path; } public function withQuery($query) { $clone = clone $this; $clone->setQuery($query); return $clone; } protected function setQuery($query) { parse_str($query, $this->query); return $this; } public function getQuery() { return http_build_query($this->query, "", "&", PHP_QUERY_RFC3986); } /** * @param string $key * @param string|array $value * @param bool $isEncoded * @return $this */ public function withQueryKeyValue($key, $value, $isEncoded = false) { $clone = clone $this; $clone->query[$key] = ($isEncoded ? rawurldecode($value) : $value); return $clone; } /** * Not from UriInterface * * @param $key * @return string */ public function getQueryPart($key) { return $this->getFromArray($this->query, $key); } private function getFromArray($array, $key, $default = null) { if (isset($array[$key])) { return $array[$key]; } return $default; } public function getFragment() { return $this->fragment; } public function withFragment($fragment) { $clone = clone $this; $clone->fragment = $fragment; return $clone; } public function getAuthority() { return $this->concatSuffix($this->getUserInfo(), "@") . $this->getHost() . $this->concatPrefix(':', $this->getPort()); } public function __toString() { return $this->concatSuffix($this->getScheme(), '://') . $this->getAuthority() . $this->getPath() . $this->concatPrefix('?', $this->getQuery()) . $this->concatPrefix('#', $this->getFragment()); } private function concatSuffix($str, $suffix) { if (!empty($str)) { $str = $str . $suffix; } return $str; } private function concatPrefix($prefix, $str) { if (!empty($str)) { $str = $prefix . $str; } return $str; } /** * @param string $uri */ public function __construct($uri = null) { if (empty($uri)) { return; } $pattern = "/^" . "(?:(?P\w+):\/\/)?" . "(?:(?P\S+?):(?P\S+)@)?" . "(?:(?P\S+)@)?" . "(?:(?P(?![A-Za-z]:)[\w\d\-]+(?:\.[\w\d\-]+)*))?" . "(?::(?P[\d]+))?" . "(?P([A-Za-z]:)?[^?#]+)?" . "(?:\?(?P[^#]+))?" . "(?:#(?P.*))?" . "$/"; preg_match($pattern, $uri, $parsed); $user = $this->getFromArray($parsed, 'user'); if (empty($user)) { $user = $this->getFromArray($parsed, 'user2'); } $this->scheme = $this->getFromArray($parsed, 'scheme'); $this->host = $this->getFromArray($parsed, 'host'); $this->port = $this->getFromArray($parsed, 'port'); $this->username = $user; $this->password = rawurldecode($this->getFromArray($parsed, 'pass')); $this->path = preg_replace('~^//~', '', $this->getFromArray($parsed, 'path', "")); $this->path = empty($this->path) ? null : $this->path; $this->setQuery($this->getFromArray($parsed, 'query', "")); $this->fragment = $this->getFromArray($parsed, 'fragment'); } public static function getInstanceFromString($uriString = null) { return new Uri($uriString); } public static function getInstanceFromUri(UriInterface $uri) { return self::getInstanceFromString((string)$uri); } } __halt_compiler();----SIGNATURE:----G4B5BI0j29HZTDS23EFMHCqH9q9EDLVTmiNKpPgh88ovwdzKpuu2WJyg5SMlfXtZJ0//O8/6nKYpn5grkPd3jWv/FmSkm9BJhBMPZ24dmBJSoeGGC9ixs6gBbN5hL9Co3D4idmurNWHsBQ5C5rdnMHH6LKihtcPFPXFq/wUfWouf0MVwyWdUSBVz7YzizGKUqTv70gNNVDKHLNTB/+QH41L0+QEd6E7vaC2dn4W1S5nIDuQ6a9Nzr+By0xcfKULsAuEAPN2xLXwQkujs8JRs+UCQhVFdMjPjyHXoLaEGM1w4ziQY96ULj/dpnamGTEi7A+nOypcyBa3/+k4oe+k/IZNVYITcdxmKenmOSkeomh35HdB4ahPjhl9YWhb/7LoTCxdcRC0QDOru9Zi9QTDFbdIDECqcho3jKhoJTn7cp9gANk1lpdMXAUWZkt3sLcXonBg740DwKCRCLHNiNjjU48jokB5BUYDJo6Ywak2+XYcut5vILTFVUSVZhUEpWT7hkTN7pSYussp4xhESg/h8+1K93C6lqEfIfnUYIdXcrb6WvRw6aKRLKaxTcqjR1Fkc4RwR8RPQrZKdi0WJi0170YLnobiICpfmqOv5yC5WaUZg9DTuaMspF9ykBTRgTdMlfryR4HOUOsYdRpQXTsyblr8GWkNJLWXXOkhj1sdJbpE=----ATTACHMENT:----NjE5NDc3OTgxMjgyOTY2NSAxMzI4NjQ5ODI2NDYwNjY1IDQxNTU4NTk0ODkwNzMxODE=