diff options
Diffstat (limited to 'src/Request.php')
-rw-r--r-- | src/Request.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/Request.php b/src/Request.php index 586134d..ceb7dbb 100644 --- a/src/Request.php +++ b/src/Request.php @@ -21,7 +21,12 @@ class Request if (isset($requestUrl['query'])) { foreach (explode('&', $requestUrl['query']) as $queryString) { $query = explode('=', $queryString); - $this->query[$query[0]] = $query[1] ?? null; + + if (empty($query[1])) { + $this->query['input'] = $query[0]; + } else { + $this->query[$query[0]] = $query[1]; + } } } } @@ -45,4 +50,21 @@ class Request { return $this->path; } + + public function getQuery(): array + { + return $this->query; + } + + public function get(string $key): mixed + { + return $this->query[$key] ?? null; + } + + public function set(string $key, string $value): self + { + $this->query[$key] = $value; + + return $this; + } } |