From d8035412c020e9fa1ff6a4520c87e2aad92314f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 30 Aug 2021 14:05:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-server/Message/Uri.php | 39 +++++++++++++++---------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/http-server/Message/Uri.php b/http-server/Message/Uri.php index fb07bcd3..89718618 100644 --- a/http-server/Message/Uri.php +++ b/http-server/Message/Uri.php @@ -120,9 +120,8 @@ class Uri implements UriInterface */ public function withScheme($scheme): UriInterface { - $class = clone $this; - $class->scheme = $scheme; - return $class; + $this->scheme = $scheme; + return $this; } /** @@ -132,10 +131,9 @@ class Uri implements UriInterface */ public function withUserInfo($user, $password = null): UriInterface { - $class = clone $this; - $class->username = $user; - $class->password = $password; - return $class; + $this->username = $user; + $this->password = $password; + return $this; } @@ -145,9 +143,8 @@ class Uri implements UriInterface */ public function withHost($host): UriInterface { - $class = clone $this; - $class->host = $host; - return $class; + $this->host = $host; + return $this; } @@ -166,9 +163,8 @@ class Uri implements UriInterface */ public function withPort($port): UriInterface { - $class = clone $this; - $class->port = $port; - return $class; + $this->port = $port; + return $this; } @@ -178,9 +174,8 @@ class Uri implements UriInterface */ public function withPath($path): UriInterface { - $class = clone $this; - $class->path = $path; - return $class; + $this->path = $path; + return $this; } @@ -190,9 +185,8 @@ class Uri implements UriInterface */ public function withQuery($query): UriInterface { - $class = clone $this; - $class->query = $query; - return $class; + $this->query = $query; + return $this; } @@ -202,9 +196,8 @@ class Uri implements UriInterface */ public function withFragment($fragment): UriInterface { - $class = clone $this; - $class->fragment = $fragment; - return $class; + $this->fragment = $fragment; + return $this; } @@ -222,7 +215,7 @@ class Uri implements UriInterface * @param \Swoole\Http\Request $request * @return UriInterface */ - #[Pure] public static function parseUri(\Swoole\Http\Request $request): UriInterface + public static function parseUri(\Swoole\Http\Request $request): UriInterface { $server = $request->server; $header = $request->header;