mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-03 08:19:58 +00:00
Development
- Removed unused exception from PHP-docs. - Fixed types not same as declared. - Fixed issues with reg-ex and php-unit tests. - Removed unnecessary type casting. - Declared functions as static (better scoping + performance). - Moved `\is_callable($callback) === false` as the execution costs less than previous in `Router.php`. - Changed `ob_get_contents` to `ob_get_clean`. - Added type hints to methods.
This commit is contained in:
@@ -75,7 +75,7 @@ class SimpleRouter
|
||||
try {
|
||||
ob_start();
|
||||
static::router()->setDebugEnabled(true)->start();
|
||||
$routerOutput = ob_get_contents();
|
||||
$routerOutput = ob_get_clean();
|
||||
ob_end_clean();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -458,15 +458,8 @@ class SimpleRouter
|
||||
try {
|
||||
return static::router()->getUrl($name, $parameters, $getParams);
|
||||
} catch (\Exception $e) {
|
||||
try {
|
||||
return new Url('/');
|
||||
} catch (MalformedUrlException $e) {
|
||||
|
||||
}
|
||||
return new Url('/');
|
||||
}
|
||||
|
||||
// This will never happen...
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user