db = $db; } /** * Summary of getUser * @param int $id * @param string $apikey * * @throws Exception * * @return User */ public function getUser(int $id, string $apikey): User { $user = new User($this->db); if (($user->fetch($id) < 1) || ($user->api_key !== $apikey) || (intval($user->statut) !== User::STATUS_ENABLED)) { throw new RestException(404, 'User not found'); } return $user; } }