1<?php 2 3namespace IXR\Request; 4 5use IXR\DataType\Value; 6 7/** 8 * IXR_Request 9 * 10 * @package IXR 11 * @since 1.5.0 12 */ 13class Request 14{ 15 private $method; 16 private $args; 17 private $xml; 18 19 public function __construct($method, $args) 20 { 21 $this->method = $method; 22 $this->args = $args; 23 $this->xml = <<<EOD 24<?xml version="1.0"?> 25<methodCall> 26<methodName>{$this->method}</methodName> 27<params> 28 29EOD; 30 foreach ($this->args as $arg) { 31 $this->xml .= '<param><value>'; 32 $v = new Value($arg); 33 $this->xml .= $v->getXml(); 34 $this->xml .= "</value></param>\n"; 35 } 36 $this->xml .= '</params></methodCall>'; 37 } 38 39 public function getLength() 40 { 41 return strlen($this->xml); 42 } 43 44 public function getXml() 45 { 46 return $this->xml; 47 } 48} 49