mirror of
https://git.beihong.wang/wangbeihong/blog-source.git
synced 2026-04-23 14:43:05 +08:00
initial
This commit is contained in:
67
var/IXR/Error.php
Executable file
67
var/IXR/Error.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user