From 7f892b0772580034ddf37181a831278b6d33c11d Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 29 Sep 2023 16:15:42 +0300 Subject: [PATCH] add value definition support --- src/app/model/request.php | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/app/model/request.php b/src/app/model/request.php index ae47d3b..cf09450 100644 --- a/src/app/model/request.php +++ b/src/app/model/request.php @@ -15,8 +15,13 @@ class AppModelRequest { $this->_server = $server; } - public function get(string $key) : mixed + public function get(string $key, mixed $value = null) : mixed { + if ($value) + { + $this->_get[$key] = $value; + } + if (isset($this->_get[$key])) { return $this->_get[$key]; @@ -28,8 +33,13 @@ class AppModelRequest { } } - public function post(string $key) : mixed + public function post(string $key, mixed $value = null) : mixed { + if ($value) + { + $this->_get[$key] = $value; + } + if (isset($this->_post[$key])) { return $this->_post[$key]; @@ -41,8 +51,13 @@ class AppModelRequest { } } - public function files(string $key) : mixed + public function files(string $key, mixed $value = null) : mixed { + if ($value) + { + $this->_get[$key] = $value; + } + if (isset($this->_files[$key])) { return $this->_files[$key]; @@ -54,8 +69,13 @@ class AppModelRequest { } } - public function server(string $key) : mixed + public function server(string $key, mixed $value = null) : mixed { + if ($value) + { + $this->_get[$key] = $value; + } + if (isset($this->_get[$key])) { return $this->_get[$key];