示例#1
0
 /**
  * Constructor.
  *
  * @param resource|string $xml The XML document received from the server.
  */
 public function __construct($xml)
 {
     if (is_resource($xml)) {
         rewind($xml);
         $xml = stream_get_contents($xml);
     }
     parent::registerNamespace('xlink', 'http://www.w3.org/1999/xlink');
     parent::__construct($xml);
     $this->_packages = $this->_buildPackageList();
 }
示例#2
0
文件: Base.php 项目: horde/horde
 /**
  * Handle null or array values for $this->_element by initializing
  * with $this->_emptyXml, and importing the array with
  * Horde_Xml_Element::fromArray() if necessary.
  *
  * @see Horde_Xml_Element::__wakeup
  * @see Horde_Xml_Element::fromArray
  */
 public function __wakeup()
 {
     // If we've been passed an array, we'll store it for importing
     // after initializing with the default "empty" feed XML.
     $importArray = null;
     if (is_null($this->_element)) {
         $this->_element = $this->_emptyXml;
     } elseif (is_array($this->_element)) {
         $importArray = $this->_element;
         $this->_element = $this->_emptyXml;
     }
     parent::__wakeup();
     if (!is_null($importArray)) {
         $this->fromArray($importArray);
     }
 }