Auth_OpenID_ServerError::encodeToKVForm PHP Méthode

encodeToKVForm() public méthode

Encodes the response to key-value form. This is a machine-readable format used to respond to messages which came directly from the consumer and not through the user-agent. See the OpenID specification.
public encodeToKVForm ( )
    function encodeToKVForm()
    {
        return Auth_OpenID_KVForm::fromArray(array('mode' => 'error', 'error' => $this->toString()));
    }

Usage Example

Exemple #1
0
 function test_noReturnTo()
 {
     // will be a ProtocolError raised by Decode or CheckIDRequest.answer
     $args = array('openid.mode' => 'zebradance', 'openid.identity' => 'http://wagu.unittest/');
     $e = new Auth_OpenID_ServerError($args, "waffles");
     $this->assertFalse($e->hasReturnTo());
     $expected = "error:waffles\nmode:error\n";
     $this->assertEquals($e->encodeToKVForm(), $expected);
 }