mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-15 18:23:26 +03:00
Development
- Fixed updatae causing middlewares to sometimes load on wrong routes. - Converted project to PSR/2. - Updated InputCollection class and added get method for easy access to values. - Complete refactor of RouterBase. - Added findRoute method to RouterBase. - It's now possible to change parameter modifiers and symbol by overwriting properties on RouterBase. - Added RouterUrlTest unit-test for testing route-urls. - Added IRestController that can be easily implemented in custom ResourceController-classes. - It's now possible to use "-" instead of "_" when using getHeader method in Request class. - Added PHPDocs. - Fixed "/" route sometimes returning "//" as url. - Optimisations and bugfixes.
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
<?php
|
||||
|
||||
class DummyController {
|
||||
class DummyController
|
||||
{
|
||||
public function start()
|
||||
{
|
||||
echo static::class . '@' . 'start() OK';
|
||||
}
|
||||
|
||||
public function start() {
|
||||
echo static::class . '@' .'start() OK';
|
||||
}
|
||||
public function param($params = null)
|
||||
{
|
||||
$params = func_get_args();
|
||||
echo 'Params: ' . join(', ', $params);
|
||||
}
|
||||
|
||||
public function param($params = null) {
|
||||
$params = func_get_args();
|
||||
echo 'Params: ' . join(', ', $params);
|
||||
}
|
||||
public function notFound()
|
||||
{
|
||||
echo 'not found';
|
||||
}
|
||||
|
||||
public function notFound() {
|
||||
echo 'not found';
|
||||
}
|
||||
public function silent() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
require_once 'Exceptions/MiddlewareLoadedException.php';
|
||||
|
||||
use Pecee\Http\Middleware\IMiddleware;
|
||||
use Pecee\Http\Request;
|
||||
|
||||
class DummyMiddleware implements IMiddleware {
|
||||
|
||||
public function handle(Request $request, \Pecee\SimpleRouter\RouterEntry &$route = null) {
|
||||
throw new MiddlewareLoadedException('Middleware loaded!');
|
||||
}
|
||||
class DummyMiddleware implements IMiddleware
|
||||
{
|
||||
public function handle(Request $request, \Pecee\SimpleRouter\RouterEntry &$route = null)
|
||||
{
|
||||
throw new MiddlewareLoadedException('Middleware loaded!');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,2 +1,4 @@
|
||||
<?php
|
||||
class MiddlewareLoadedException extends \Exception {}
|
||||
class MiddlewareLoadedException extends \Exception
|
||||
{
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
class ExceptionHandler implements \Pecee\Handler\IExceptionHandler {
|
||||
|
||||
public function handleError(\Pecee\Http\Request $request, \Pecee\SimpleRouter\RouterEntry &$route = null, \Exception $error){
|
||||
throw $error;
|
||||
}
|
||||
class ExceptionHandler implements \Pecee\Handler\IExceptionHandler
|
||||
{
|
||||
public function handleError(\Pecee\Http\Request $request, \Pecee\SimpleRouter\RouterEntry &$route = null, \Exception $error)
|
||||
{
|
||||
throw $error;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user