mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-16 10:40:18 +03:00
Development
- Fixed: only set default namespace on relative callbacks. - Fixed: default-namespace not being set when calling `SimpleRouter::resource`. - Minor optimisations.
This commit is contained in:
@@ -237,16 +237,23 @@ class Request
|
||||
{
|
||||
$this->rewriteRoute = $route;
|
||||
|
||||
$namespace = SimpleRouter::getDefaultNamespace();
|
||||
$callback = $route->getCallback();
|
||||
|
||||
if ($namespace !== null) {
|
||||
/* Only add default namespace on relative callbacks */
|
||||
if($callback === null || $callback[0] !== '\\') {
|
||||
|
||||
$namespace = SimpleRouter::getDefaultNamespace();
|
||||
|
||||
if ($namespace !== null) {
|
||||
|
||||
if ($this->rewriteRoute->getNamespace() !== null) {
|
||||
$namespace .= '\\' . $this->rewriteRoute->getNamespace();
|
||||
}
|
||||
|
||||
$this->rewriteRoute->setDefaultNamespace($namespace);
|
||||
|
||||
if ($this->rewriteRoute->getNamespace() !== null) {
|
||||
$namespace .= '\\' . $this->rewriteRoute->getNamespace();
|
||||
}
|
||||
|
||||
$this->rewriteRoute->setDefaultNamespace($namespace);
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user