xref: /dokuwiki/vendor/kissifrot/php-ixr/src/Message/Error.php (revision 64d8abdb11b92482cec4f0ec0320b91fea20322f)
17f8f2456SAndreas Gohr<?php
27f8f2456SAndreas Gohrnamespace IXR\Message;
37f8f2456SAndreas Gohr
47f8f2456SAndreas Gohr/**
57f8f2456SAndreas Gohr * IXR_Error
67f8f2456SAndreas Gohr *
77f8f2456SAndreas Gohr * @package IXR
87f8f2456SAndreas Gohr * @since 1.5.0
97f8f2456SAndreas Gohr */
107f8f2456SAndreas Gohrclass Error
117f8f2456SAndreas Gohr{
127f8f2456SAndreas Gohr    public $code;
137f8f2456SAndreas Gohr    public $message;
147f8f2456SAndreas Gohr
157f8f2456SAndreas Gohr    public function __construct($code, $message)
167f8f2456SAndreas Gohr    {
177f8f2456SAndreas Gohr        $this->code = $code;
187f8f2456SAndreas Gohr        $this->message = htmlspecialchars($message);
197f8f2456SAndreas Gohr    }
207f8f2456SAndreas Gohr
217f8f2456SAndreas Gohr    public function getXml()
227f8f2456SAndreas Gohr    {
23*64d8abdbSAndreas Gohr        return <<<EOD
247f8f2456SAndreas Gohr<methodResponse>
257f8f2456SAndreas Gohr  <fault>
267f8f2456SAndreas Gohr    <value>
277f8f2456SAndreas Gohr      <struct>
287f8f2456SAndreas Gohr        <member>
297f8f2456SAndreas Gohr          <name>faultCode</name>
307f8f2456SAndreas Gohr          <value><int>{$this->code}</int></value>
317f8f2456SAndreas Gohr        </member>
327f8f2456SAndreas Gohr        <member>
337f8f2456SAndreas Gohr          <name>faultString</name>
347f8f2456SAndreas Gohr          <value><string>{$this->message}</string></value>
357f8f2456SAndreas Gohr        </member>
367f8f2456SAndreas Gohr      </struct>
377f8f2456SAndreas Gohr    </value>
387f8f2456SAndreas Gohr  </fault>
397f8f2456SAndreas Gohr</methodResponse>
407f8f2456SAndreas GohrEOD;
417f8f2456SAndreas Gohr    }
427f8f2456SAndreas Gohr}
43