- Fixes made on route querying and filtering

This commit is contained in:
Dave M. 2021-02-16 03:05:51 +00:00
parent 3f8f24a35f
commit 56a5c45588
2 changed files with 14 additions and 14 deletions

View File

@ -41,9 +41,9 @@ class Route implements \Notes\Annotation {
public function getRoute() : string public function getRoute() : string
{ {
return "/" . trim(isset($this->base) ? return rtrim("/" . trim(isset($this->base) ?
"/" . trim($this->base, "/") . "/" . ltrim($this->route, "/") "/" . trim($this->base, "/") . "/" . ltrim($this->route, "/")
: :
"/" . ltrim($this->route, "/"), "/"); "/" . ltrim($this->route, "/"), "/"), '/');
} }
} }

View File

@ -80,22 +80,22 @@ class RouteFetcher {
} }
$routeList = $objectResolver->getAnnotationListFromClassname( $this->annotations['method'] ); $routeList = $objectResolver->getAnnotationListFromClassname( $this->annotations['method'] );
foreach($routeList as $func => $routes) {
foreach($routes as $route) {
$route->base = $base;
$route->class = $class;
$route->classMethod = $func;
foreach($routeList as $func => $route) { if (false === ($route->methods ?? false)) {
$route->methods = $methods;
}
$route->base = $base; if (false !== ($this->callback ?? false)) {
$route->class = $class; call_user_func_array($this->callback, [$route]);
$route->classMethod = $func; }
if ( false === ( $route->methods ?? false ) ) { yield $route;
$route->methods = $methods;
} }
if ( false !== ( $this->callback ?? false ) ) {
call_user_func_array($this->callback, [ $route ]);
}
yield $route;
} }
} }
} }