$app->halt(401, json_encode(['error' => 'The token is incorrect'])); } $app->halt(500, json_encode(['error' => $schedule->response->message])); } $scheduleData = $schedule->response->data; function cmp($a, $b) { return strcmp($a->start, $b->start); } usort($scheduleData, "cmp"); $authStatus = checkAuth($user, $userToken); if ($authStatus === true) { $password = getPassword($user, $userToken); $integrater = new integrate(); $portal = new Portal(); if ($portal->login($user, $password)) { createResponse($integrater::addPresention($scheduleData, $portal->getPresention(), $week + 1)); } else { $app->halt(401, json_encode(['error' => 'Wrong Password or Username!'])); } } else { $app->halt(401, json_encode($authStatus)); } }); // Itslearning $app->get('/itslearning/subjects/:username/:password', function ($username, $password) use($app) { $itslearning = new Itslearning(); createResponse($itslearning->getSubjects($username, $password)); }); $app->get('/itslearning/digitalcontents/:username/:password', function ($username, $password) use($app) { $itslearning = new Itslearning();