From 667b834d09b2372360a7b1c54f970717f329ceac Mon Sep 17 00:00:00 2001 From: Divine Niiquaye Ibok Date: Sun, 29 May 2022 14:12:37 +0000 Subject: [PATCH] Added fragment support to generated uri class --- src/Generator/GeneratedUri.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Generator/GeneratedUri.php b/src/Generator/GeneratedUri.php index 4694a5e..cb50843 100644 --- a/src/Generator/GeneratedUri.php +++ b/src/Generator/GeneratedUri.php @@ -144,4 +144,16 @@ public function withQuery(array $queryParams = []): self return $this; } + + /** + * Set the fragment component of the URI + */ + public function withFragment(string $fragment): self + { + if (!empty($fragment)) { + $this->pathInfo .= '#' . $fragment; + } + + return $this; + } }