original_string: public function createRecoveryToken(User $user): UserResetToken
      {
          if (!$this->resetTokenProvider) {
              throw new PasswordResetProhibitedException('The configuration currently prohibits the resetting of passwords!');
          }
  
          $auth = $this->authenticationProvider->findByUserId($user->getId());
          if (!$auth) {
              throw new NoSuchUserException();
          }
  
          if ($this->resetTokenProvider->getRequestCount($auth) > 5) {
              throw new TooManyRecoveryAttemptsException();
          }
  
          $this->resetTokenProvider->invalidateUnusedTokens($auth);
  
          $remote = new RemoteAddress();
          $remote->setUseProxy(true);
          $token = new UserResetToken($auth, $remote->getIpAddress());
          $this->resetTokenProvider->save($token);
  
          return $token;
      }
code: public function createRecoveryToken(User $user): UserResetToken
      {
          if (!$this->resetTokenProvider) {
              throw new PasswordResetProhibitedException('The configuration currently prohibits the resetting of passwords!');
          }
  
          $auth = $this->authenticationProvider->findByUserId($user->getId());
          if (!$auth) {
              throw new NoSuchUserException();
          }
  
          if ($this->resetTokenProvider->getRequestCount($auth) > 5) {
              throw new TooManyRecoveryAttemptsException();
          }
  
          $this->resetTokenProvider->invalidateUnusedTokens($auth);
  
          $remote = new RemoteAddress();
          $remote->setUseProxy(true);
          $token = new UserResetToken($auth, $remote->getIpAddress());
          $this->resetTokenProvider->save($token);
  
          return $token;
      }
code_tokens: public function createRecoveryToken ( User $ user ) : UserResetToken { if ( ! $ this -> resetTokenProvider ) { throw new PasswordResetProhibitedException ( 'The configuration currently prohibits the resetting of passwords!' ) ; } $ auth = $ this -> authenticationProvider -> findByUserId ( $ user -> getId ( ) ) ; if ( ! $ auth ) { throw new NoSuchUserException ( ) ; } if ( $ this -> resetTokenProvider -> getRequestCount ( $ auth ) > 5 ) { throw new TooManyRecoveryAttemptsException ( ) ; } $ this -> resetTokenProvider -> invalidateUnusedTokens ( $ auth ) ; $ remote = new RemoteAddress ( ) ; $ remote -> setUseProxy ( true ) ; $ token = new UserResetToken ( $ auth , $ remote -> getIpAddress ( ) ) ; $ this -> resetTokenProvider -> save ( $ token ) ; return $ token ; }
docstring: Forgot-password mechanisms are a potential back door; but they're needed.  This only takes care
  of hash generation.
  
  @param User $user
  
  @return UserResetToken
  @throws NoSuchUserException
  @throws PasswordResetProhibitedException
  @throws TooManyRecoveryAttemptsException
docstring_tokens: Forgot - password mechanisms are a potential back door ; but they re needed . This only takes care of hash generation .