in src/TypedFunctionWrapper.php [80:103]
public function execute(ServerRequestInterface $request): ResponseInterface
{
try {
$argInst = $this->functionArgClass->newInstance();
} catch (ReflectionException $e) {
throw new LogicException('Function request class cannot be instantiated');
}
$body = $request->getBody()->getContents();
try {
$argInst->mergeFromJsonString($body);
} catch (Exception $e) {
throw new BadRequestError($e->getMessage(), 0, $e);
}
$funcResult = call_user_func($this->function, $argInst);
if (!method_exists($funcResult, "serializeToJsonString")) {
throw new LogicException("Return type must implement 'serializeToJsonString'");
}
$resultJson = $funcResult->serializeToJsonString();
return new Response(200, ['content-type' => 'application/json'], $resultJson);
}