Skip to content

Commit

Permalink
Update Controller.php
Browse files Browse the repository at this point in the history
  • Loading branch information
juancristobalgd1 authored Aug 4, 2024
1 parent 6d391c7 commit d402b6b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ private function registerDefaultMiddleware()
{
$middlewares = BaseMiddleware::$httpMiddlewares;
foreach ($middlewares as $middleware) {
if (is_subclass_of($middleware, BaseMiddleware::class)) {
if (is_subclass_of($middleware, BaseMiddleware::class))
$this->middlewares[] = new $middleware;
}
}
}

Expand Down Expand Up @@ -185,10 +184,9 @@ public function request(): ?Request
*/
public function __call(string $name, array $params)
{
if (method_exists($this, $name)) {
if (method_exists($this, $name))
return $this->$name(...$params);
}


throw new BadMethodCallException(sprintf('Method [%s] does not exist', $name));
}
}

0 comments on commit d402b6b

Please sign in to comment.