public static function fromConfig($config, UserContext $context)
    {
        $name = $config['username'];
        switch ($config['usertype']) {
            case DirectAdmin::ACCOUNT_TYPE_USER:
                return new self($name, $context, $config);
            case DirectAdmin::ACCOUNT_TYPE_RESELLER:
                return new Reseller($name, $context, $config);
            case DirectAdmin::ACCOUNT_TYPE_ADMIN:
                return new Admin($name, $context, $config);
            default:
                throw new DirectAdminException("Unknown user type '$config[usertype]'");
        }
    }
public static function fromConfig($config, UserContext $context)
    {
        $name = $config['username'];
        switch ($config['usertype']) {
            case DirectAdmin::ACCOUNT_TYPE_USER:
                return new self($name, $context, $config);
            case DirectAdmin::ACCOUNT_TYPE_RESELLER:
                return new Reseller($name, $context, $config);
            case DirectAdmin::ACCOUNT_TYPE_ADMIN:
                return new Admin($name, $context, $config);
            default:
                throw new DirectAdminException("Unknown user type '$config[usertype]'");
        }
    }
public static function fromConfig ( $ config , UserContext $ context ) { $ name = $ config [ 'username' ] ; switch ( $ config [ 'usertype' ] ) { case DirectAdmin :: ACCOUNT_TYPE_USER : return new self ( $ name , $ context , $ config ) ; case DirectAdmin :: ACCOUNT_TYPE_RESELLER : return new Reseller ( $ name , $ context , $ config ) ; case DirectAdmin :: ACCOUNT_TYPE_ADMIN : return new Admin ( $ name , $ context , $ config ) ; default : throw new DirectAdminException ( "Unknown user type '$config[usertype]'" ) ; } }
Constructs the correct object from the given user config.

@param array $config The raw config from DirectAdmin
@param UserContext $context The context within which the config was retrieved
@return Admin|Reseller|User The correct object
@throws DirectAdminException If the user type could not be determined
Constructs the correct object from the given user config .