Auth_OpenID_Message::_fixNS PHP Method

_fixNS() public method

public _fixNS ( $namespace )
    function _fixNS($namespace)
    {
        // Convert an input value into the internally used values of
        // this object
        if ($namespace == Auth_OpenID_OPENID_NS) {
            if ($this->_openid_ns_uri === null) {
                return new Auth_OpenID_FailureResponse(null, 'OpenID namespace not set');
            } else {
                $namespace = $this->_openid_ns_uri;
            }
        }
        if ($namespace != Auth_OpenID_BARE_NS && !is_string($namespace)) {
            //TypeError
            $err_msg = sprintf("Namespace must be Auth_OpenID_BARE_NS, " . "Auth_OpenID_OPENID_NS or a string. got %s", print_r($namespace, true));
            return new Auth_OpenID_FailureResponse(null, $err_msg);
        }
        if ($namespace != Auth_OpenID_BARE_NS && strpos($namespace, ':') === false) {
            // fmt = 'OpenID 2.0 namespace identifiers SHOULD be URIs. Got %r'
            // warnings.warn(fmt % (namespace,), DeprecationWarning)
            if ($namespace == 'sreg') {
                // fmt = 'Using %r instead of "sreg" as namespace'
                // warnings.warn(fmt % (SREG_URI,), DeprecationWarning,)
                return Auth_OpenID_SREG_URI;
            }
        }
        return $namespace;
    }