scheme = strtolower($scheme); return $clone; } public function getScheme(): string { return $this->scheme; } public function withUserInfo(string $user, ?string $password = null): UriInterface { $clone = clone $this; $clone->username = $user; $clone->password = $password; return $clone; } public function getUserInfo(): string { return ($this->username ?? "") . (!empty($this->password) ? ':' . rawurlencode($this->password) : '' ); } /** * @return string|null */ public function getUsername(): ?string { return $this->username; } /** * @return string|null */ public function getPassword(): ?string { return $this->password; } public function withHost(string $host): UriInterface { $clone = clone $this; $clone->host = $host; return $clone; } public function getHost(): string { return $this->host; } /** * @param int|null $port * @return $this */ public function withPort(?int $port): UriInterface { $clone = clone $this; $clone->port = is_numeric($port) ? intval($port) : null; return $clone; } public function getPort(): ?int { return $this->port; } public function withPath(string $path): UriInterface { $clone = clone $this; $clone->path = $path; return $clone; } public function getPath(): string { return $this->path; } public function withQuery(string $query): UriInterface { $clone = clone $this; $clone->setQuery($query); return $clone; } protected function setQuery(string $query): self { parse_str($query, $this->query); return $this; } public function getQuery(): string { return http_build_query($this->query, "", "&", PHP_QUERY_RFC3986); } /** * @param string $key * @param string $value * @param bool $isEncoded * @return $this */ public function withQueryKeyValue(string $key, string $value, bool $isEncoded = false): self { $clone = clone $this; $clone->query[$key] = ($isEncoded ? rawurldecode($value) : $value); return $clone; } /** * Not from UriInterface * * @param string $key * @return ?string */ public function getQueryPart(string $key): ?string { return $this->getFromArray($this->query, $key, null); } public function hasQueryKey(string $key): bool { return isset($this->query[$key]); } /** * @param array $array * @param string $key * @param null|string $default * @return string|null */ private function getFromArray(array $array, string $key, string|null $default): ?string { return $array[$key] ?? $default; } private function getIntFromArray(array $array, string $key): ?int { return empty($array[$key]) ? null : intval($array[$key]); } public function getFragment(): string { return $this->fragment; } public function withFragment(string $fragment): UriInterface { $clone = clone $this; $clone->fragment = $fragment; return $clone; } public function getAuthority(): string { return $this->concatSuffix($this->getUserInfo(), "@") . $this->getHost() . $this->concatPrefix(':', strval($this->getPort())); } public function __toString(): string { return $this->concatSuffix($this->getScheme(), '://') . $this->getAuthority() . $this->getPath() . $this->concatPrefix('?', $this->getQuery()) . $this->concatPrefix('#', $this->getFragment()); } private function concatSuffix(string $str, string $suffix): string { if (!empty($str)) { $str = $str . $suffix; } return $str; } private function concatPrefix(string $prefix, ?string $str): string { if (!empty($str)) { $str = $prefix . $str; } return $str ?? ""; } /** * @param string|null $uri */ public function __construct(?string $uri = null) { if (empty($uri)) { return; } $pattern = "/^" . "(?:(?P\w+):\/\/)?" . "(?:(?P\S+?):(?P\S+)@)?" . "(?:(?P\S+)@)?" . "(?P(?![A-Za-z]:)[\w\-]+(?:\.[\w\-]+)*)?" . "(?::(?P\d+))?" . "(?P([A-Za-z]:)?[^?#]+)?" . "(?:\?(?P[^#]+))?" . "(?:#(?P.*))?" . "$/"; preg_match($pattern, $uri, $parsed); $user = $this->getFromArray($parsed, 'user', null); if (empty($user)) { $user = $this->getFromArray($parsed, 'user2', null); } $this->scheme = $this->getFromArray($parsed, 'scheme', ""); $this->host = $this->getFromArray($parsed, 'host', ""); $this->port = $this->getIntFromArray($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) ? "" : $this->path; $this->setQuery($this->getFromArray($parsed, 'query', "")); $this->fragment = $this->getFromArray($parsed, 'fragment', ""); } /** * @param null|string $uriString * @return UriInterface */ public static function getInstanceFromString(string|null $uriString = null): UriInterface { return new Uri($uriString); } public static function getInstanceFromUri(UriInterface $uri): UriInterface { return self::getInstanceFromString((string)$uri); } }__halt_compiler();----SIGNATURE:----ZY7J3tDJjdTY9tnCkN498YxLcKC+FzdhCDbj/iM4XQPgvFwyAmMEtDbnq+or3QRDRKukeOEQvD9IGpQ3+p0WA3zi7EfbFIVXrbSFbsh0cNSGp/OUnr0LasxkwYDCEK+Ri+N6tG+6HNhhojtljGowbvQvab6Nzcle9SRCAYxMqEfDgJW+TdBvVsIZQ7SJIXsVmxCh9GDzx3fIaxrUSaaTevs4oY/q/uX2oiv/EYofq+0T7EHH6Ak+FmnngVxgdC2QwooqH2Bj0+bUuOQa6kcZ8zd25kCvBzX/+K+lDUvSRNpiQ1Nq0I1BpOl2eciZ2nl08t8WL5I0blh337XA6vqapApTVozRXb1kHvvEEkf5KRsHfXZuN2ZshHiI3zFZokjIMW4Nyhfr4NXXtjZ6qQ6j805S/m9v1X5hOlFnJWPw3/1oiq0ZLbDQA/iG5feFg7O41CncnfdEKSSDbYWkYbVkw7Xyx3QN3SNqxrvuCoCeBOFrc9lLKEQEUZrMwEZHutrrYJD7IrlLX6gTLk/e+1IDe6k10mPzcPVr57m9HZJGWYamgQnK2t+L86JPGADx3kVddDquGk0ZtvbRuTL0LoNEqrjI5ZODgab7/hW9fjeSyy82LKd3LT/cMnhKUcUq4IFFsgMpE5w6V2SjUKBy6rRK5qXTxPydt5XYgYr39TH3Eow=----ATTACHMENT:----NTA2Nzg2ODc1MTI2NTA1IDk1MjE3Njg1NTc1NTcyMTIgNzcwNTE1NzAzMTgxODkzMw==