diff options
Diffstat (limited to 'vendor/kissifrot/php-ixr/src/Request/Request.php')
-rw-r--r-- | vendor/kissifrot/php-ixr/src/Request/Request.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/kissifrot/php-ixr/src/Request/Request.php b/vendor/kissifrot/php-ixr/src/Request/Request.php new file mode 100644 index 000000000..2664fb7a8 --- /dev/null +++ b/vendor/kissifrot/php-ixr/src/Request/Request.php @@ -0,0 +1,48 @@ +<?php + +namespace IXR\Request; + +use IXR\DataType\Value; + +/** + * IXR_Request + * + * @package IXR + * @since 1.5.0 + */ +class Request +{ + private $method; + private $args; + private $xml; + + public function __construct($method, $args) + { + $this->method = $method; + $this->args = $args; + $this->xml = <<<EOD +<?xml version="1.0"?> +<methodCall> +<methodName>{$this->method}</methodName> +<params> + +EOD; + foreach ($this->args as $arg) { + $this->xml .= '<param><value>'; + $v = new Value($arg); + $this->xml .= $v->getXml(); + $this->xml .= "</value></param>\n"; + } + $this->xml .= '</params></methodCall>'; + } + + public function getLength() + { + return strlen($this->xml); + } + + public function getXml() + { + return $this->xml; + } +} |