/** * @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; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $token = $this->registerTokens->addToken(); $link = sprintf('/register/?token=%s', $token); $output->writeln(sprintf('<info>%s</info>', $link)); }