case 'get:posts-search-var': return new PostsController('search', $var); case 'get:gamers': return new GamersController('all'); case 'post:users-facebook': return new UsersController('singinByFacebook'); case 'post:users-token': return new UsersController('readByToken'); case 'post:ms-newlesson': return new MesalvaController('newLesson'); case 'post:ms-readlesson': return new MesalvaController('readLesson'); default: return null; } } $url_last = count(Globals::get('url')); $try = bothRoutes(REST::getRouteName()); while (is_null($try) && $url_last > 0) { $url = Globals::get('url'); $var = $url[--$url_last]; $url[$url_last] = 'var'; $route = strtolower($_SERVER['REQUEST_METHOD']) . ':'; $route .= implode('-', $url); $try = bothRoutes($route, $var); if (!is_null($try)) { exit; } } REST::return404(['route' => Globals::get('route'), 'inputs' => REST::getInputs()]);