public function getResultsXml() { $xml = new SimpleXMLElement('<stats/>'); $xml->clients = $this->_stats->clients; $xml->domains = $this->_stats->domains; $xml->mail_boxes = $this->_stats->mail_boxes; $xml->databases = $this->_stats->databases; return (string) $xml->saveXml(); }
/** * Set XML * * @param SimpleXMLElement $xml OSM XML * * @return Services_OpenStreetMap_Comment */ public function setXml(SimpleXMLElement $xml) { $this->xml = $xml->saveXml(); $obj = $xml->xpath('//' . $this->getType()); $kids = array(); foreach ($obj[0]->children() as $child) { $key = (string) $child->attributes()->k; if ($key != '') { $this->tags[$key] = (string) $child->attributes()->v; } $name = (string) $child->getName(); $kids[$name] = (string) $child; } $this->tags = $kids; if (isset($kids['id'])) { $this->setId($kids['id']); } $this->obj = $obj; return $this; }
/** * Set XML. * * @param SimpleXMLElement $xml OSM XML * * @return Services_OpenStreetMap_Object */ public function setXml(SimpleXMLElement $xml) { $this->xml = $xml->saveXml(); $obj = $xml->xpath('//' . $this->getType()); foreach ($obj[0]->children() as $child) { $key = (string) $child->attributes()->k; if ($key != '') { $this->tags[$key] = (string) $child->attributes()->v; } } $this->obj = $obj; return $this; }
/** * Set XML * * @param SimpleXMLElement $xml OSM XML * * @return Services_OpenStreetMap_Note */ public function setXml(SimpleXMLElement $xml) { $this->xml = $xml->saveXml(); $obj = $xml->xpath('//' . $this->getType()); $kids = array(); foreach ($obj[0]->children() as $child) { $key = (string) $child->attributes()->k; if ($key != '') { $this->tags[$key] = (string) $child->attributes()->v; } $name = (string) $child->getName(); if ($name == 'comments') { $comments = array(); foreach ($child->children() as $gchild) { $comment = new Services_OpenStreetMap_Comment(); $comment->setXml($gchild); $comments[] = $comment; } $kids[] = $comments; } elseif ($name == 'id') { $this->setId((double) $child); } } $this->comments = new Services_OpenStreetMap_Comments($comments); $this->tags = $kids; $this->obj = $obj; return $this; }