Scalr_Account::createUser PHP Method

createUser() public method

public createUser ( string $email, string $password, $type ) : Scalr_Account_User
$email string
$password string
return Scalr_Account_User
    public function createUser($email, $password, $type)
    {
        if (!$this->id) {
            throw new Exception("Account is not created");
        }
        $this->validateLimit(Scalr_Limits::ACCOUNT_USERS, 1);
        $user = Scalr_Account_User::init()->create($email, $this->id);
        $user->updatePassword($password);
        $user->type = $type;
        $user->status = Scalr_Account_User::STATUS_ACTIVE;
        $user->save();
        $keys = Scalr::GenerateAPIKeys();
        $user->setSetting(Scalr_Account_User::SETTING_API_ACCESS_KEY, $keys['id']);
        $user->setSetting(Scalr_Account_User::SETTING_API_SECRET_KEY, $keys['key']);
        return $user;
    }