Skip to content

Instantly share code, notes, and snippets.

@Crell
Created June 10, 2016 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Crell/d0d75a6112b14c18b44078351ec1fd33 to your computer and use it in GitHub Desktop.
Save Crell/d0d75a6112b14c18b44078351ec1fd33 to your computer and use it in GitHub Desktop.
function the_real_all(ServerRequestInterface $req, callable $next) {
$action = $req->getAttribute('_action');
$args = $req->getAttribute('_arguments);
$result = $action(...$args);
if (! $result instanceof ResponseInterface) {
$responder = resolve_responder(get_class($result));
$result = $responder($result);
}
return $next($req, $result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment