/** * Attr request constructor * @param array $attrs * @return self */ public function __construct(array $attrs = []) { parent::__construct(); $this->setAttrs($attrs); $this->on('before', function (Request $sender) { if ($sender->getAttrs()->count()) { $sender->setChild('a', $sender->getAttrs()->all()); } }); }
/** * Method returning the xml representation of this class * * @return SimpleXML */ public function toXml() { $soapNamespace = $this->_version === self::SOAP_1_2 ? self::NS_SOAP_1_2 : self::NS_SOAP_1_1; $nsString = 'xmlns:env="' . $soapNamespace . '"'; foreach ($this->_namespaces as $key => $ns) { if ($key > 0) { $nsString .= sprintf(' xmlns:urn%d="%s"', $key, $ns); } else { $nsString .= sprintf(' xmlns:urn="%s"', $ns); } } $message = sprintf('<env:Envelope %s></env:Envelope>', $nsString); $xml = new SimpleXML($message); if (count($this->_headers)) { $header = $xml->addChild('Header')->addChild('context', null, 'urn:zimbra'); foreach ($this->_headers as $name => $value) { $header->addChild($name, $value); } } $body = $xml->addChild('Body'); $body->append($this->_body, $this->_request->getXmlNamespace()); return $xml; }
public function __construct($foo, $bar) { parent::__construct(); $this->setChild('foo', trim($foo)); $this->setChild('bar', trim($bar)); }
/** * Constructor method for base request * @param string $value * @return self */ public function __construct($value = null) { parent::__construct($value); $this->setXmlNamespace('urn:zimbraAdmin'); }
/** * Batch request constructor * @param array $requests * @return self */ public function __construct(array $requests = []) { parent::__construct(); $this->setRequests($requests); }