Files
typecho/var/IXR/Request.php
joyqi 4c8c64c79e Feat/code refactor (#1626)
* remove all magic methods, add type for class properties

* refactor codes

* fix all

* refactor code

* fix type

* fix all

* fix request is method

* fix all

* fix router

* fix get page
2023-09-24 16:21:32 +08:00

56 lines
896 B
PHP

<?php
namespace IXR;
/**
* IXR请求体
*
* @package IXR
*/
class Request
{
/**
* @var string
*/
private string $xml;
/**
* @param string $method
* @param array $args
*/
public function __construct(string $method, array $args)
{
$this->xml = <<<EOD
<?xml version="1.0"?>
<methodCall>
<methodName>{$method}</methodName>
<params>
EOD;
foreach ($args as $arg) {
$this->xml .= '<param><value>';
$v = new Value($arg);
$this->xml .= $v->getXml();
$this->xml .= "</value></param>\n";
}
$this->xml .= '</params></methodCall>';
}
/**
* @return int
*/
public function getLength(): int
{
return strlen($this->xml);
}
/**
* @return string
*/
public function getXml(): string
{
return $this->xml;
}
}