diff --git a/src/Libs/Router.php b/src/Libs/Router.php index 5cdb7c0..c4eb377 100644 --- a/src/Libs/Router.php +++ b/src/Libs/Router.php @@ -328,24 +328,13 @@ class Router { */ public static function apply(): void { $path = static::currentPath(); - $routers = []; - switch ($_SERVER['REQUEST_METHOD']){ // Según el método selecciona un arreglo de routers configurados - case 'POST': - $routers = static::$post; - break; - case 'PUT': - $routers = static::$put; - break; - case 'PATCH': - $routers = static::$patch; - break; - case 'DELETE': - $routers = static::$delete; - break; - default: - $routers = static::$get; - break; - } + $routers = match($_SERVER['REQUEST_METHOD']) { // Según el método selecciona un arreglo de routers configurados + 'POST' => static::$post, + 'PUT' => static::$put, + 'PATCH' => static::$patch, + 'DELETE' => static::$delete, + default => static::$get + }; $req = static::getReq();