/** * Constructor * * @param array params */ public function __construct($params) { $this->item = new XPSoapNode('hash', null, ['xmlns:hash' => 'http://xml.apache.org/xml-soap', 'xsi:type' => 'hash:Map']); foreach ($params as $key => $value) { $this->item->addChild(XPSoapNode::fromArray(['key' => $key, 'value' => $value], 'item')); } }
/** * Helper method * * @param var $object * @return webservices.soap.xp.XPSoapNode */ protected function node($object) { return XPSoapNode::fromArray([$object], 'array', new XPSoapMapping())->nodeAt(0); }
/** * Set data * * @param array arr */ public function setData($arr) { $node = XPSoapNode::fromArray($arr, 'item', $this->mapping); $node->namespace = $this->namespace; if (!$node->hasChildren()) { return; } // Copy all of node's children to root element foreach (array_keys($node->getChildren()) as $i) { $this->body->nodeAt(0)->addChild($node->nodeAt($i)); } }
protected function node($object) { $node = XPSoapNode::fromArray(array($object), 'array', new XPSoapMapping()); return $node->nodeAt(0); }