mirror of
https://git.beihong.wang/wangbeihong/blog-source.git
synced 2026-04-23 11:13:04 +08:00
68 lines
1.0 KiB
PHP
Executable File
68 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace IXR;
|
|
|
|
/**
|
|
* IXR错误
|
|
*
|
|
* @package IXR
|
|
*/
|
|
class Error
|
|
{
|
|
/**
|
|
* 错误代码
|
|
*
|
|
* @access public
|
|
* @var integer
|
|
*/
|
|
public int $code;
|
|
|
|
/**
|
|
* 错误消息
|
|
*
|
|
* @access public
|
|
* @var string|null
|
|
*/
|
|
public ?string $message;
|
|
|
|
/**
|
|
* 构造函数
|
|
*
|
|
* @param integer $code 错误代码
|
|
* @param string $message 错误消息
|
|
*/
|
|
public function __construct(int $code, string $message)
|
|
{
|
|
$this->code = $code;
|
|
$this->message = $message;
|
|
}
|
|
|
|
/**
|
|
* 获取xml
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getXml(): string
|
|
{
|
|
return <<<EOD
|
|
<methodResponse>
|
|
<fault>
|
|
<value>
|
|
<struct>
|
|
<member>
|
|
<name>faultCode</name>
|
|
<value><int>{$this->code}</int></value>
|
|
</member>
|
|
<member>
|
|
<name>faultString</name>
|
|
<value><string>{$this->message}</string></value>
|
|
</member>
|
|
</struct>
|
|
</value>
|
|
</fault>
|
|
</methodResponse>
|
|
|
|
EOD;
|
|
}
|
|
}
|