@@ -18,6 +18,11 @@ class Uri implements Htmlable, Responsable
1818{
1919    use  Conditionable, Tappable;
2020
21+     /** 
22+      * The URI instance. 
23+      */ 
24+     protected  UriInterface $ uri
25+ 
2126    /** 
2227     * The URL generator resolver. 
2328     */ 
@@ -75,29 +80,17 @@ public function scheme(): ?string
7580     */ 
7681    public  function  user (bool  $ withPasswordfalse ): ?string 
7782    {
78-         if  ($ withPassword
79-             return  $ this uri ->getUserInfo ();
80-         }
81- 
82-         $ userInfo$ this uri ->getUserInfo ();
83- 
84-         if  (is_null ($ userInfo
85-             return  null ;
86-         }
87- 
88-         return  str_contains ($ userInfo': ' )
89-             ? Str::before ($ userInfo': ' )
90-             : $ userInfo
83+         return  $ withPassword
84+             ? $ this uri ->getUserInfo ()
85+             : $ this uri ->getUsername ();
9186    }
9287
9388    /** 
9489     * Get the password from the URI. 
9590     */ 
9691    public  function  password (): ?string 
9792    {
98-         $ userInfo$ this uri ->getUserInfo ();
99- 
100-         return  ! is_null ($ userInfoafter ($ userInfo': ' ) : null ;
93+         return  $ this uri ->getPassword ();
10194    }
10295
10396    /** 
@@ -272,7 +265,7 @@ public function withFragment(string $fragment): static
272265     */ 
273266    public  function  redirect (int  $ status302 , array  $ headersRedirectResponse 
274267    {
275-         return  new  RedirectResponse (( string )  $ this $ status$ headers
268+         return  new  RedirectResponse ($ this -> value () , $ status$ headers
276269    }
277270
278271    /** 
@@ -283,7 +276,7 @@ public function redirect(int $status = 302, array $headers = []): RedirectRespon
283276     */ 
284277    public  function  toResponse ($ request
285278    {
286-         return  new  RedirectResponse (( string )  $ this 
279+         return  new  RedirectResponse ($ this -> value () );
287280    }
288281
289282    /** 
@@ -293,7 +286,7 @@ public function toResponse($request)
293286     */ 
294287    public  function  toHtml ()
295288    {
296-         return  ( string )  $ this 
289+         return  $ this -> value () ;
297290    }
298291
299292    /** 
@@ -309,7 +302,7 @@ public function value(): string
309302     */ 
310303    public  function  isEmpty (): bool 
311304    {
312-         return  trim (( string )  $ this '' ;
305+         return  trim ($ this -> value () ) === '' ;
313306    }
314307
315308    /** 
0 commit comments