/** * Return the data from the message. * * @return var */ public function getData() { $ret = array(); if (!is('xml.Node', $this->tree->root()->nodeAt(0)->nodeAt(0)->nodeAt(0)) || 'value' != $this->tree->root()->nodeAt(0)->nodeAt(0)->nodeAt(0)->getName()) { throw new IllegalStateException('No node "params" found.'); } // Process params node $decoder = new XmlRpcDecoder(); // Access node /methodResponse/params/param/value node return $decoder->decode($this->tree->root()->nodeAt(0)->nodeAt(0)->nodeAt(0)); }
/** * Return the data from the message. * * @return var */ public function getData() { $ret = array(); foreach (array_keys($this->tree->root()->getChildren()) as $idx) { if ('params' != $this->tree->root()->nodeAt($idx)->getName()) { continue; } // Process params node $decoder = new XmlRpcDecoder(); foreach (array_keys($this->tree->root()->nodeAt($idx)->getChildren()) as $params) { $ret[] = $decoder->decode($this->tree->root()->nodeAt($idx)->nodeAt($params)->nodeAt(0)); } return $ret; } throw new IllegalStateException('No node "params" found.'); }
/** * Retrieve the fault if there is one. * * @return webservices.xmlrpc.XmlRpcFault or NULL if no fault exists */ public function getFault() { // First check whether the fault-node exists if (!is('xml.Node', $this->tree->root()->nodeAt(0)) || 'fault' != $this->tree->root()->nodeAt(0)->getName()) { return NULL; } $decoder = new XmlRpcDecoder(); $data = $decoder->decode($this->tree->root()->nodeAt(0)->nodeAt(0)); $f = new XmlRpcFault($data['faultCode'], $data['faultString']); return $f; }