/** * @param UserVO $user * @param Session|SessionInterface $session * @param string $token * @throws UserException * @return int */ public function registerUser(UserVO $user, Session $session, $token = null) : int { $this->checkInput($user); if (!$this->registrationEnabled && $token !== null && !$this->registerTokens->fetchToken($token)) { throw new UserException('You have to provide a valid register token!'); } $userId = $this->userProvider->register($user); $session->set('user', $user); return $userId; }