Skip to content

Commit

Permalink
rename EndpointRouteHandler
Browse files Browse the repository at this point in the history
- change the name of EndpointRouteHandler to ControllerRouteHandler
  • Loading branch information
Maometos committed Nov 25, 2023
1 parent 9411cdf commit af2abf5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use DevNet\Web\Routing\IRouteHandler;
use DevNet\Web\Routing\RouteContext;

class EndpointRouteHandler implements IRouteHandler
class ControllerRouteHandler implements IRouteHandler
{
use PropertyTrait;

Expand All @@ -43,12 +43,12 @@ public function handle(RouteContext $routeContext): Task
$controllerName = $this->target[0];
$actionName = $this->target[1];
if (!class_exists($controllerName)) {
throw new ClassException("Could not find the class {$controllerName}", 404);
throw new ClassException("Could not find the class {$controllerName}");
}

if (!method_exists($controllerName, $actionName)) {
if (!method_exists($controllerName, "async_" . $actionName)) {
throw new MethodException("Call to undefined method {$controllerName}::{$actionName}()", 404);
throw new MethodException("Call to undefined method {$controllerName}::{$actionName}()");
} else {
$actionName = "async_" . $actionName;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Endpoint/EndpointRouteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function mapControllers(?string $area = null, Closure $configure = null)
if ($area) {
$path = '/' . $area . $route->Path;
}
$this->builder->map($path, new EndpointRouteHandler([$className, $method->getName()], $options), $route->Method);
$this->builder->map($path, new ControllerRouteHandler([$className, $method->getName()], $options), $route->Method);
}
}
}
Expand Down

0 comments on commit af2abf5

Please sign in to comment.