Skip to content

Instantly share code, notes, and snippets.

@jasonlewis
Last active August 29, 2015 14:07
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 jasonlewis/84461972f233b1cf153a to your computer and use it in GitHub Desktop.
Save jasonlewis/84461972f233b1cf153a to your computer and use it in GitHub Desktop.
<?php
public function run(Request $request)
{
$this->container = $this->container ?: new Container;
return call_user_func(
array_reduce(array_reverse($this->middlewares), function($stack, $middleware)
{
return function($request) use ($stack, $middleware)
{
return $this->container->make($middleware)->handle($request, $stack);
};
},
function() use ($request)
{
return call_user_func($this->app, $request);
}),
$request);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment