Created
August 8, 2016 15:10
-
-
Save iolloyd/1223ac7fc6a2cb23f19f8a2f387a6fed to your computer and use it in GitHub Desktop.
How slim v3 makes the app available in the callback
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
public function add(\Slim\Middleware $newMiddleware) | |
{ | |
if(in_array($newMiddleware, $this->middleware)) { | |
$middleware_class = get_class($newMiddleware); | |
throw new \RuntimeException("Circular Middleware setup detected. Tried to queue the same Middleware instance ({$middleware_class}) twice."); | |
} | |
$newMiddleware->setApplication($this); | |
$newMiddleware->setNextMiddleware($this->middleware[0]); | |
array_unshift($this->middleware, $newMiddleware); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment