static function getLrsFromUserPass($username, $password) { $client = Helpers::getClient($username, $password); $lrs = $client === null ? null : \Lrs::find($client->lrs_id); if ($lrs === null) { throw new Exceptions\Exception('Unauthorized request.', 401); } return $lrs; }
/** * Gets the current LRS from the Authorization header. * @return \Lrs */ static function getLrsFromAuth() { list($username, $password) = Helpers::getUserPassFromAuth(); return Helpers::getLrsFromUserPass($username, $password); }