1<?php
2namespace IXR\Message;
3
4/**
5 * IXR_Error
6 *
7 * @package IXR
8 * @since 1.5.0
9 */
10class Error
11{
12    public $code;
13    public $message;
14
15    public function __construct($code, $message)
16    {
17        $this->code = $code;
18        $this->message = htmlspecialchars($message);
19    }
20
21    public function getXml()
22    {
23        $xml = <<<EOD
24<methodResponse>
25  <fault>
26    <value>
27      <struct>
28        <member>
29          <name>faultCode</name>
30          <value><int>{$this->code}</int></value>
31        </member>
32        <member>
33          <name>faultString</name>
34          <value><string>{$this->message}</string></value>
35        </member>
36      </struct>
37    </value>
38  </fault>
39</methodResponse>
40EOD;
41        return $xml;
42    }
43}
44