Development

- Changed router so it supports both string and object as exception handlers.
- Added `Router::error($callback)` method to `Router` class (issue #238).
- Fixed issues calling `getController` and `getMethod` when callback is an object (issue #239).
- Updated documentation to reflect new changes.
- Added `addExceptionHandler` to `IGroupRoute` interface and `RouteGroup` class.
- Other minor bugfixes and optimisations.
This commit is contained in:
Simon Sessingø
2017-07-06 15:25:04 +02:00
parent 9dd80dd1d9
commit ca381d445f
12 changed files with 182 additions and 18 deletions
@@ -1,6 +1,8 @@
<?php
namespace Pecee\SimpleRouter\Route;
use Pecee\Handlers\IExceptionHandler;
use Pecee\Http\Request;
class RouteGroup extends Route implements IGroupRoute
@@ -54,6 +56,19 @@ class RouteGroup extends Route implements IGroupRoute
return $this->matchDomain($request);
}
/**
* Add exception handler
*
* @param IExceptionHandler $handler
* @return static $this
*/
public function addExceptionHandler(IExceptionHandler $handler)
{
$this->exceptionHandlers[] = $handler;
return $this;
}
/**
* Set exception-handlers for group
*