src/Sulu/Bundle/SecurityBundle/Controller/ResettingController.php
private function getUniqueToken($startToken)
    {
        try {
            $this->getUserRepository()->findUserByToken($startToken);
        } catch (NoResultException $ex) {
            return $startToken;
        }

        return $this->getUniqueToken($this->getTokenGenerator()->generateToken());
    }
private function getUniqueToken($startToken)
    {
        try {
            $this->getUserRepository()->findUserByToken($startToken);
        } catch (NoResultException $ex) {
            return $startToken;
        }

        return $this->getUniqueToken($this->getTokenGenerator()->generateToken());
    }
private function getUniqueToken ( $ startToken ) { try { $ this -> getUserRepository ( ) -> findUserByToken ( $ startToken ) ; } catch ( NoResultException $ ex ) { return $ startToken ; } return $ this -> getUniqueToken ( $ this -> getTokenGenerator ( ) -> generateToken ( ) ) ; }
If the passed token is unique returns it back otherwise returns a unique token.

@param string $startToken The token to start width

@return string a unique token
If the passed token is unique returns it back otherwise returns a unique token .