private function findNonExistingUserEmail( $username = 'User' )
    {
        $userManager = $this->getUserManager();
        $email = "${username}@ez.no";
        if ( $userManager->checkUserExistenceByEmail( $email ) )
        {
            return $email;
        }

        for ( $i = 0; $i < 20; $i++ )
        {
            $email = uniqid('User#', true) . '@ez.no';
            if ( !$userManager->checkUserExistenceByEmail( $email ) )
            {
                return $email;
            }
        }

        throw new \Exception( 'Possible endless loop when attempting to find a new email for User.' );
    }
private function findNonExistingUserEmail( $username = 'User' )
    {
        $userManager = $this->getUserManager();
        $email = "${username}@ez.no";
        if ( $userManager->checkUserExistenceByEmail( $email ) )
        {
            return $email;
        }

        for ( $i = 0; $i < 20; $i++ )
        {
            $email = uniqid('User#', true) . '@ez.no';
            if ( !$userManager->checkUserExistenceByEmail( $email ) )
            {
                return $email;
            }
        }

        throw new \Exception( 'Possible endless loop when attempting to find a new email for User.' );
    }
private function findNonExistingUserEmail ( $ username = 'User' ) { $ userManager = $ this -> getUserManager ( ) ; $ email = "${username}@ez.no" ; if ( $ userManager -> checkUserExistenceByEmail ( $ email ) ) { return $ email ; } for ( $ i = 0 ; $ i < 20 ; $ i ++ ) { $ email = uniqid ( 'User#' , true ) . '@ez.no' ; if ( ! $ userManager -> checkUserExistenceByEmail ( $ email ) ) { return $ email ; } } throw new \ Exception ( 'Possible endless loop when attempting to find a new email for User.' ) ; }
Find a non existing User email

@return string A not used email

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