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