public function current() { if ($this->type == DOC_TYPE_ARRAY) { return CPS_Response::simpleXmlToArray(current($this->_data)); } else { if ($this->type == DOC_TYPE_STDCLASS) { return CPS_Response::simpleXmlToStdClass(current($this->_data)); } else { return current($this->_data); } } }
/** * Helper function for conversions. Used internally. */ static function simpleXmlToArrayHelper(&$res, &$key, &$value, &$children) { if (isset($res[$key])) { if (is_string($res[$key]) || is_array($res[$key]) && is_assoc($res[$key])) { $res[$key] = array($res[$key]); } $res[$key][] = CPS_Response::simpleXmlToArray($value); } else { $res[$key] = CPS_Response::simpleXmlToArray($value); } $children = true; }