Created
December 3, 2018 16:31
-
-
Save acwoss/493303733e2167c610f82f4271e30a63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pipeline = new Pipeline([ | |
function ($request, $next) { | |
if (!isset($request->getAttribute('user'))) { | |
return new Response(401, 'Sai daqui demônio!'); | |
} | |
return $next->handle($request); | |
}, | |
function ($request, $next) { | |
return new Response(200, 'Oi :D'); | |
} | |
]); | |
$request = Request::fromGlobals(); | |
echo $pipeline->handle($request); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment