src/User/Factory.php
public function make(string $username, string $password, string $email): User
    {
        $this->validate(compact('username', 'password', 'email'));

        $user = wp_create_user($username, $password, $email);

        if (is_a($user, 'WP_Error')) {
            if ('existing_user_login' === $user->get_error_code()) {
                throw new DuplicateUserException($user->get_error_message());
            }

            throw new UserException($user->get_error_message());
        }

        return $this->get($user);
    }
public function make(string $username, string $password, string $email): User
    {
        $this->validate(compact('username', 'password', 'email'));

        $user = wp_create_user($username, $password, $email);

        if (is_a($user, 'WP_Error')) {
            if ('existing_user_login' === $user->get_error_code()) {
                throw new DuplicateUserException($user->get_error_message());
            }

            throw new UserException($user->get_error_message());
        }

        return $this->get($user);
    }
public function make ( string $ username , string $ password , string $ email ) : User { $ this -> validate ( compact ( 'username' , 'password' , 'email' ) ) ; $ user = wp_create_user ( $ username , $ password , $ email ) ; if ( is_a ( $ user , 'WP_Error' ) ) { if ( 'existing_user_login' === $ user -> get_error_code ( ) ) { throw new DuplicateUserException ( $ user -> get_error_message ( ) ) ; } throw new UserException ( $ user -> get_error_message ( ) ) ; } return $ this -> get ( $ user ) ; }
Create a WordPress user and save it to the database.

@param string $username
@param string $password
@param string $email

@throws UserException
@throws DuplicateUserException

@return User
Create a WordPress user and save it to the database .