This commit is contained in:
2021-08-30 14:05:24 +08:00
parent 895a83b094
commit d8035412c0
+16 -23
View File
@@ -120,9 +120,8 @@ class Uri implements UriInterface
*/ */
public function withScheme($scheme): UriInterface public function withScheme($scheme): UriInterface
{ {
$class = clone $this; $this->scheme = $scheme;
$class->scheme = $scheme; return $this;
return $class;
} }
/** /**
@@ -132,10 +131,9 @@ class Uri implements UriInterface
*/ */
public function withUserInfo($user, $password = null): UriInterface public function withUserInfo($user, $password = null): UriInterface
{ {
$class = clone $this; $this->username = $user;
$class->username = $user; $this->password = $password;
$class->password = $password; return $this;
return $class;
} }
@@ -145,9 +143,8 @@ class Uri implements UriInterface
*/ */
public function withHost($host): UriInterface public function withHost($host): UriInterface
{ {
$class = clone $this; $this->host = $host;
$class->host = $host; return $this;
return $class;
} }
@@ -166,9 +163,8 @@ class Uri implements UriInterface
*/ */
public function withPort($port): UriInterface public function withPort($port): UriInterface
{ {
$class = clone $this; $this->port = $port;
$class->port = $port; return $this;
return $class;
} }
@@ -178,9 +174,8 @@ class Uri implements UriInterface
*/ */
public function withPath($path): UriInterface public function withPath($path): UriInterface
{ {
$class = clone $this; $this->path = $path;
$class->path = $path; return $this;
return $class;
} }
@@ -190,9 +185,8 @@ class Uri implements UriInterface
*/ */
public function withQuery($query): UriInterface public function withQuery($query): UriInterface
{ {
$class = clone $this; $this->query = $query;
$class->query = $query; return $this;
return $class;
} }
@@ -202,9 +196,8 @@ class Uri implements UriInterface
*/ */
public function withFragment($fragment): UriInterface public function withFragment($fragment): UriInterface
{ {
$class = clone $this; $this->fragment = $fragment;
$class->fragment = $fragment; return $this;
return $class;
} }
@@ -222,7 +215,7 @@ class Uri implements UriInterface
* @param \Swoole\Http\Request $request * @param \Swoole\Http\Request $request
* @return UriInterface * @return UriInterface
*/ */
#[Pure] public static function parseUri(\Swoole\Http\Request $request): UriInterface public static function parseUri(\Swoole\Http\Request $request): UriInterface
{ {
$server = $request->server; $server = $request->server;
$header = $request->header; $header = $request->header;