$password = getPassword($user, $token); $portal = new Portal(); if ($portal->login($user, $password)) { createResponse($portal->getGrades($period)); } } else { $app->halt(401, json_encode($authStatus)); } }); $app->get('/portal/students/classlist/:user/:token', function ($user, $token) use($app) { $authStatus = checkAuth($user, $token); if ($authStatus === true) { $password = getPassword($user, $token); $portal = new Portal(); if ($portal->login($user, $password)) { createResponse($portal->getClassList()); } } else { $app->halt(401, json_encode($authStatus)); } }); $app->get('/portal/students/presention/:user/:token', function ($user, $token) use($app) { $authStatus = checkAuth($user, $token); if ($authStatus === true) { $password = getPassword($user, $token); $portal = new Portal(); if ($portal->login($user, $password)) { createResponse($portal->getPresention()); } } else { $app->halt(401, json_encode($authStatus));