Example #1
0
 /**
  * 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());
         }
     });
 }
Example #2
0
 /**
  * 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;
 }
Example #3
0
 public function __construct($foo, $bar)
 {
     parent::__construct();
     $this->setChild('foo', trim($foo));
     $this->setChild('bar', trim($bar));
 }
Example #4
0
 /**
  * Constructor method for base request
  * @param  string $value
  * @return self
  */
 public function __construct($value = null)
 {
     parent::__construct($value);
     $this->setXmlNamespace('urn:zimbraAdmin');
 }
Example #5
0
 /**
  * Batch request constructor
  * @param  array $requests
  * @return self
  */
 public function __construct(array $requests = [])
 {
     parent::__construct();
     $this->setRequests($requests);
 }