Auth_OpenID_Message::toPostArgs PHP Method

toPostArgs() public method

public toPostArgs ( )
    function toPostArgs()
    {
        // Return all arguments with openid. in front of namespaced
        // arguments.
        $args = array();
        // Add namespace definitions to the output
        foreach ($this->namespaces->iteritems() as $pair) {
            list($ns_uri, $alias) = $pair;
            if ($this->namespaces->isImplicit($ns_uri)) {
                continue;
            }
            if ($alias == Auth_OpenID_NULL_NAMESPACE) {
                $ns_key = 'openid.ns';
            } else {
                $ns_key = 'openid.ns.' . $alias;
            }
            $args[$ns_key] = $ns_uri;
        }
        foreach ($this->args->items() as $pair) {
            list($ns_parts, $value) = $pair;
            list($ns_uri, $ns_key) = $ns_parts;
            $key = $this->getKey($ns_uri, $ns_key);
            $args[$key] = $value;
        }
        return $args;
    }

Usage Example

Example #1
0
 function test_explicitOpenID11NSSerialzation()
 {
     $m = new Auth_OpenID_Message();
     $m->setOpenIDNamespace(Auth_OpenID_THE_OTHER_OPENID1_NS, false);
     $post_args = $m->toPostArgs();
     $this->assertEquals($post_args, array('openid.ns' => Auth_OpenID_THE_OTHER_OPENID1_NS));
 }