- Added a new json.html output

- Fixed a bug where post() was defined twice in request. Added server and request too
This commit is contained in:
mcndave committed 2020-03-30 12:20:28 -04:00
1 parent 404d1f4359
commit dcb22fe086
3 files changed
+38 -8

No files matched your search

+11 -1
View File
@@ -30,7 +30,8 @@ class Request implements Extension {
$context->pushFunction("cookie", [ $this, 'cookie' ]);
$context->pushFunction("get", [ $this, 'get' ]);
$context->pushFunction("post", [ $this, 'post' ]);
$context->pushFunction("post", [ $this, 'post' ]);
$context->pushFunction("request", [ $this, 'request' ]);
$context->pushFunction("server", [ $this, 'server' ]);
}
public function cookie(? string $variableName = null, $default = null)
@@ -48,7 +49,16 @@ class Request implements Extension {
return $variableName === null ? $this->request->getParsedBody() : static::arrayGet($this->request->getParsedBody(), $variableName) ?? $default;
}
<<<<<<< Updated upstream
public function server(? string $variableName = null, $default = null)
=======
public function request(? string $variableName = null)
{
return $this->post($variableName) ?? $this->get($variableName);
}
public function server(? string $variableName = null)
>>>>>>> Stashed changes
{
return $variableName === null ? $this->request->getServerParams() : static::arrayGet($this->request->getServerParams(), $variableName) ?? $default;
}