Skip to content

Commit

Permalink
refactor: Use Constants instead of Strings
Browse files Browse the repository at this point in the history
  • Loading branch information
usernane committed Dec 9, 2024
1 parent 69a8642 commit f5abbe9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webfiori/http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ public static function getParams() : array {
$requestMethod = self::getMethod();
$retVal = [];

if ($requestMethod == 'POST' || $requestMethod == 'PUT') {
if ($requestMethod == RequestMethod::POST || $requestMethod == RequestMethod::PUT || $requestMethod == RequestMethod::PATCH) {
foreach (array_keys($_POST) as $name) {
$retVal[$name] = self::filter(INPUT_POST, $name);
}
} else if ($requestMethod == 'DELETE' || $requestMethod == 'GET') {
} else if ($requestMethod == RequestMethod::DELETE || $requestMethod == RequestMethod::GET) {
foreach (array_keys($_GET) as $name) {
$retVal[$name] = self::filter(INPUT_GET, $name);
}
Expand Down Expand Up @@ -373,6 +373,8 @@ private static function filter($inputSource, $varName) {
$val = filter_var(urldecode($_POST[$varName]));
} else if ($inputSource == INPUT_GET && isset($_GET[$varName])) {
$val = filter_var(urldecode($_GET[$varName]));
} else if ($inputSource == INPUT_COOKIE && isset ($_COOKIE[$varName])) {
$val = filter_var(urldecode($_COOKIE[$varName]));
}
}

Expand Down

0 comments on commit f5abbe9

Please sign in to comment.