request interface fixes

This commit is contained in:
Yuri Kuznetsov
2021-03-02 12:27:02 +02:00
parent 312ea7d962
commit b56ae68854
3 changed files with 15 additions and 1 deletions

View File

@@ -112,6 +112,8 @@ interface Request
/**
* Get a server param value.
*
* @return ?mixed
*/
public function getServerParam(string $name);
}

View File

@@ -47,6 +47,9 @@ class RequestNull implements ApiRequest
return false;
}
/**
* @return ?string|array
*/
public function getQueryParam(string $name)
{
return null;
@@ -112,6 +115,9 @@ class RequestNull implements ApiRequest
return null;
}
/**
* @return ?mixed
*/
public function getServerParam(string $name)
{
return null;

View File

@@ -102,6 +102,9 @@ class RequestWrapper implements ApiRequest
return array_key_exists($name, $this->request->getQueryParams());
}
/**
* @return ?string|array
*/
public function getQueryParam(string $name)
{
$value = $this->request->getQueryParams()[$name] ?? null;
@@ -192,7 +195,10 @@ class RequestWrapper implements ApiRequest
return $params[$name] ?? null;
}
public function getServerParam(string $name) : ?string
/**
* @return ?mixed
*/
public function getServerParam(string $name)
{
$params = $this->request->getServerParams();