function parseExtensionArgs($ax_args)
    {
        $result = $this->_checkMode($ax_args);
        if (Auth_OpenID_AX::isError($result)) {
            return $result;
        }

        $aliases = new Auth_OpenID_NamespaceMap();

        foreach ($ax_args as $key => $value) {
            if (strpos($key, 'type.') === 0) {
                $alias = substr($key, 5);
                $type_uri = $value;

                $alias = $aliases->addAlias($type_uri, $alias);

                if ($alias === null) {
                    return new Auth_OpenID_AX_Error(
                      sprintf("Could not add alias %s for URI %s",
                              $alias, $type_uri)
                      );
                }

                $count_s = Auth_OpenID::arrayGet($ax_args, 'count.' . $alias);
                if ($count_s) {
                    $count = Auth_OpenID::intval($count_s);
                    if (($count === false) &&
                        ($count_s === Auth_OpenID_AX_UNLIMITED_VALUES)) {
                        $count = $count_s;
                    }
                } else {
                    $count = 1;
                }

                if ($count === false) {
                    return new Auth_OpenID_AX_Error(
                      sprintf("Integer value expected for %s, got %s",
                              'count.' . $alias, $count_s));
                }

                $attrinfo = Auth_OpenID_AX_AttrInfo::make($type_uri, $count,
                                                          false, $alias);

                if (Auth_OpenID_AX::isError($attrinfo)) {
                    return $attrinfo;
                }

                $this->add($attrinfo);
            }
        }

        $required = Auth_OpenID_AX_toTypeURIs($aliases,
                         Auth_OpenID::arrayGet($ax_args, 'required'));

        foreach ($required as $type_uri) {
            $attrib = $this->requested_attributes[$type_uri];
            $attrib->required = true;
        }

        $if_available = Auth_OpenID_AX_toTypeURIs($aliases,
                             Auth_OpenID::arrayGet($ax_args, 'if_available'));

        $all_type_uris = array_merge($required, $if_available);

        foreach ($aliases->iterNamespaceURIs() as $type_uri) {
            if (!in_array($type_uri, $all_type_uris)) {
                return new Auth_OpenID_AX_Error(
                  sprintf('Type URI %s was in the request but not ' .
                          'present in "required" or "if_available"',
                          $type_uri));

            }
        }

        $this->update_url = Auth_OpenID::arrayGet($ax_args, 'update_url');

        return true;
    }
function parseExtensionArgs($ax_args)
    {
        $result = $this->_checkMode($ax_args);
        if (Auth_OpenID_AX::isError($result)) {
            return $result;
        }

        $aliases = new Auth_OpenID_NamespaceMap();

        foreach ($ax_args as $key => $value) {
            if (strpos($key, 'type.') === 0) {
                $alias = substr($key, 5);
                $type_uri = $value;

                $alias = $aliases->addAlias($type_uri, $alias);

                if ($alias === null) {
                    return new Auth_OpenID_AX_Error(
                      sprintf("Could not add alias %s for URI %s",
                              $alias, $type_uri)
                      );
                }

                $count_s = Auth_OpenID::arrayGet($ax_args, 'count.' . $alias);
                if ($count_s) {
                    $count = Auth_OpenID::intval($count_s);
                    if (($count === false) &&
                        ($count_s === Auth_OpenID_AX_UNLIMITED_VALUES)) {
                        $count = $count_s;
                    }
                } else {
                    $count = 1;
                }

                if ($count === false) {
                    return new Auth_OpenID_AX_Error(
                      sprintf("Integer value expected for %s, got %s",
                              'count.' . $alias, $count_s));
                }

                $attrinfo = Auth_OpenID_AX_AttrInfo::make($type_uri, $count,
                                                          false, $alias);

                if (Auth_OpenID_AX::isError($attrinfo)) {
                    return $attrinfo;
                }

                $this->add($attrinfo);
            }
        }

        $required = Auth_OpenID_AX_toTypeURIs($aliases,
                         Auth_OpenID::arrayGet($ax_args, 'required'));

        foreach ($required as $type_uri) {
            $attrib = $this->requested_attributes[$type_uri];
            $attrib->required = true;
        }

        $if_available = Auth_OpenID_AX_toTypeURIs($aliases,
                             Auth_OpenID::arrayGet($ax_args, 'if_available'));

        $all_type_uris = array_merge($required, $if_available);

        foreach ($aliases->iterNamespaceURIs() as $type_uri) {
            if (!in_array($type_uri, $all_type_uris)) {
                return new Auth_OpenID_AX_Error(
                  sprintf('Type URI %s was in the request but not ' .
                          'present in "required" or "if_available"',
                          $type_uri));

            }
        }

        $this->update_url = Auth_OpenID::arrayGet($ax_args, 'update_url');

        return true;
    }
function parseExtensionArgs ( $ ax_args ) { $ result = $ this -> _checkMode ( $ ax_args ) ; if ( Auth_OpenID_AX :: isError ( $ result ) ) { return $ result ; } $ aliases = new Auth_OpenID_NamespaceMap ( ) ; foreach ( $ ax_args as $ key => $ value ) { if ( strpos ( $ key , 'type.' ) === 0 ) { $ alias = substr ( $ key , 5 ) ; $ type_uri = $ value ; $ alias = $ aliases -> addAlias ( $ type_uri , $ alias ) ; if ( $ alias === null ) { return new Auth_OpenID_AX_Error ( sprintf ( "Could not add alias %s for URI %s" , $ alias , $ type_uri ) ) ; } $ count_s = Auth_OpenID :: arrayGet ( $ ax_args , 'count.' . $ alias ) ; if ( $ count_s ) { $ count = Auth_OpenID :: intval ( $ count_s ) ; if ( ( $ count === false ) && ( $ count_s === Auth_OpenID_AX_UNLIMITED_VALUES ) ) { $ count = $ count_s ; } } else { $ count = 1 ; } if ( $ count === false ) { return new Auth_OpenID_AX_Error ( sprintf ( "Integer value expected for %s, got %s" , 'count.' . $ alias , $ count_s ) ) ; } $ attrinfo = Auth_OpenID_AX_AttrInfo :: make ( $ type_uri , $ count , false , $ alias ) ; if ( Auth_OpenID_AX :: isError ( $ attrinfo ) ) { return $ attrinfo ; } $ this -> add ( $ attrinfo ) ; } } $ required = Auth_OpenID_AX_toTypeURIs ( $ aliases , Auth_OpenID :: arrayGet ( $ ax_args , 'required' ) ) ; foreach ( $ required as $ type_uri ) { $ attrib = $ this -> requested_attributes [ $ type_uri ] ; $ attrib -> required = true ; } $ if_available = Auth_OpenID_AX_toTypeURIs ( $ aliases , Auth_OpenID :: arrayGet ( $ ax_args , 'if_available' ) ) ; $ all_type_uris = array_merge ( $ required , $ if_available ) ; foreach ( $ aliases -> iterNamespaceURIs ( ) as $ type_uri ) { if ( ! in_array ( $ type_uri , $ all_type_uris ) ) { return new Auth_OpenID_AX_Error ( sprintf ( 'Type URI %s was in the request but not ' . 'present in "required" or "if_available"' , $ type_uri ) ) ; } } $ this -> update_url = Auth_OpenID :: arrayGet ( $ ax_args , 'update_url' ) ; return true ; }
Given attribute exchange arguments, populate this FetchRequest.

@param array $ax_args
@return Auth_OpenID_AX_Error|bool if the data to be parsed
does not follow the attribute exchange specification. At least
when 'if_available' or 'required' is not specified for a
particular attribute type.  Returns true otherwise.
Given attribute exchange arguments populate this FetchRequest .