Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Use http-interop process()
Browse files Browse the repository at this point in the history
Instead of `__invoke()`, for forwards compatibility once PSR-15 is
ratified.
  • Loading branch information
weierophinney committed May 1, 2017
1 parent 6d09019 commit 6a4bf9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/MiddlewareListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Zend\Psr7Bridge\Psr7ServerRequest as Psr7Request;
use Zend\Psr7Bridge\Psr7Response;
use Zend\Router\RouteMatch;
use Zend\Stratigility\Delegate\CallableDelegateDecorator;
use Zend\Stratigility\MiddlewarePipe;

class MiddlewareListener extends AbstractListenerAggregate
Expand Down Expand Up @@ -81,13 +82,12 @@ public function onDispatch(MvcEvent $event)
foreach ($routeMatch->getParams() as $key => $value) {
$psr7Request = $psr7Request->withAttribute($key, $value);
}
$return = $pipe(
$psr7Request,
$psr7ResponsePrototype,
$return = $pipe->process($psr7Request, new CallableDelegateDecorator(
function (PsrServerRequestInterface $request, PsrResponseInterface $response) {
throw ReachedFinalHandlerException::create();
}
);
},
$psr7ResponsePrototype
));
} catch (\Throwable $ex) {
$caughtException = $ex;
} catch (\Exception $ex) { // @TODO clean up once PHP 7 requirement is enforced
Expand Down

0 comments on commit 6a4bf9f

Please sign in to comment.