private function removeTokenInRequest(RequestInterface
$request): void
{ assert($request instanceof Request
);
$json =
json_decode($request->
getBody() ?? ''
);
if (isset($_POST[$this->config->tokenName
])) { // We kill this since we're done and we don't want to pollute the POST array.
unset($_POST[$this->config->tokenName
]);
$request->
setGlobal('post',
$_POST);
} elseif (isset($json->
{$this->config->tokenName
})) { // We kill this since we're done and we don't want to pollute the JSON data.
unset($json->
{$this->config->tokenName
});
$request->
setBody(json_encode($json));
} } private function getPostedToken(RequestInterface
$request): ?string
{ assert($request instanceof IncomingRequest
);