summaryrefslogtreecommitdiffstats
path: root/src/Router.php
diff options
context:
space:
mode:
authorArnold Daniels <arnold@jasny.net>2016-10-20 19:50:05 +0200
committerGitHub <noreply@github.com>2016-10-20 19:50:05 +0200
commit17e7a0af39e479c554d5dc4a064678d9fde71fc0 (patch)
treeab4a4f26492ac3c0262f801a8f90251eff1cfdf2 /src/Router.php
parentbbd7fe10d23e838271c94dbca59dd986cb7c8620 (diff)
parentaf57d0a805b1abdf1bd529902d820a586b3b7455 (diff)
downloadrouter-origin/router-cleanup.zip
router-origin/router-cleanup.tar.gz
router-origin/router-cleanup.tar.bz2
Merge pull request #10 from Minstel/middleware-errorsorigin/router-cleanup
Middleware errors
Diffstat (limited to 'src/Router.php')
-rw-r--r--src/Router.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Router.php b/src/Router.php
index 955e1e1..18c40be 100644
--- a/src/Router.php
+++ b/src/Router.php
@@ -78,7 +78,7 @@ class Router
* @param ResponseInterface $response
* @return ResponseInterface
*/
- final public function run(ServerRequestInterface $request, ResponseInterface $response)
+ final public function handle(ServerRequestInterface $request, ResponseInterface $response)
{
return $this->__invoke($request, $response);
}
@@ -93,11 +93,11 @@ class Router
*/
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next = null)
{
- $handle = [$this, 'handle'];
+ $run = [$this, 'run'];
- #Call to $this->handle will be executed last in the chain of middlewares
- $next = function(ServerRequestInterface $request, ResponseInterface $response) use ($next, $handle) {
- return call_user_func($handle, $request, $response, $next);
+ #Call to $this->run will be executed last in the chain of middlewares
+ $next = function(ServerRequestInterface $request, ResponseInterface $response) use ($next, $run) {
+ return call_user_func($run, $request, $response, $next);
};
#Build middlewares call chain, so that the last added was executed in first place
@@ -118,7 +118,7 @@ class Router
* @param callback $next
* @return ResponseInterface
*/
- protected function handle(ServerRequestInterface $request, ResponseInterface $response, $next = null)
+ public function run(ServerRequestInterface $request, ResponseInterface $response, $next = null)
{
$glob = new Glob($this->routes);
$route = $glob->getRoute($request);