private function findNonExistingUserName()
    {
        $userManager = $this->getUserManager();
        for ( $i = 0; $i < 20; $i++ )
        {
            $username = substr(uniqid('User#', true), 0, 15);
            if ( !$userManager->checkUserExistenceByUsername( $username ) )
            {
                return $username;
            }
        }

        throw new \Exception( 'Possible endless loop when attempting to find a new name for User.' );
    }
private function findNonExistingUserName()
    {
        $userManager = $this->getUserManager();
        for ( $i = 0; $i < 20; $i++ )
        {
            $username = substr(uniqid('User#', true), 0, 15);
            if ( !$userManager->checkUserExistenceByUsername( $username ) )
            {
                return $username;
            }
        }

        throw new \Exception( 'Possible endless loop when attempting to find a new name for User.' );
    }
private function findNonExistingUserName ( ) { $ userManager = $ this -> getUserManager ( ) ; for ( $ i = 0 ; $ i < 20 ; $ i ++ ) { $ username = substr ( uniqid ( 'User#' , true ) , 0 , 15 ) ; if ( ! $ userManager -> checkUserExistenceByUsername ( $ username ) ) { return $ username ; } } throw new \ Exception ( 'Possible endless loop when attempting to find a new name for User.' ) ; }
Find a non existing User name

@return string A not used name

@throws \Exception Possible endless loop
Find a non existing User name