mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Development
- Removed temporary `RouterException` class. - Added object-types to parameters in `CallbackExceptionHandler` and `SimpleRouter` classes. - Router now renders groups even if callback is null. - Renamed `setMiddleware` to `addMiddleware` in `Route` class and `IRoute` interface. - `addMiddleware` now accept both object and class strings in `Route` class. - `addExceptionHandler` now accept both object and class strings in `RouteGroup` class. - Added unit-test for rewrite-exception message change: `testRewriteExceptionMessage` in `RouterRewriteTest`. - Fixed typo: renamed `testSimularUrls` to `testSimilarUrls` in `RouterUrlTest`.
This commit is contained in:
@@ -36,10 +36,12 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
||||
|
||||
$middleware = $this->getMiddlewares()[$i];
|
||||
|
||||
$middleware = $this->loadClass($middleware);
|
||||
if (is_object($middleware) === false) {
|
||||
$middleware = $this->loadClass($middleware);
|
||||
}
|
||||
|
||||
if (($middleware instanceof IMiddleware) === false) {
|
||||
throw new HttpException($middleware . ' must be instance of Middleware');
|
||||
throw new HttpException($middleware . ' must be inherit the IMiddleware interface');
|
||||
}
|
||||
|
||||
$middleware->handle($request);
|
||||
|
||||
Reference in New Issue
Block a user