public function addUser(User $user) { if (!($user->getType() == 'P' || $user->getType() == 'O')) { throw new SSSException(ErrorFactory::ERR_WRONG_USER_TYPE); } $userMod = new UserModel(); try { $userFound = $userMod->add($user); if ($userFound === FALSE) { throw new SSSException(ErrorFactory::ERR_DB_INVALID_RESULT); } $ret['result'] = "success"; $ret['data']['user_id'] = $userFound; return $ret; } catch (SSSException $e) { return $e->getError(); } }