Open
Description
I'm looking to modify the ControllerInvoker to allow the route to return a different response which can be converted to a ResponseInterface at a later stage. Specifically I'm looking to implement something like juliangut/slim-routing (https://github.com/juliangut/slim-routing/blob/master/src/Strategy/RequestResponseNamedArgs.php).
Would you be open to adding a call to an intermediary methodin the __invoke method, for example:
public function __invoke(): ResponseInterface
{
// ...
return $this->processResponse($this->invoker->call($callable, $parameters));
}
protected function processResponse($response): ResponseInterface
{
return $response;
}
This would allow for sub-classing for the ControllerInvoker, such that alternative response types could be cast to the ResponseInterface after invocation, for example a controller may return:
public function example(
// ...
): PayloadResponse
{
return new PayloadResponse(
request: $request,
response: $response,
data: ['some', 'data', 'here']
);
}
Metadata
Metadata
Assignees
Labels
No labels