load() public méthode

Load an object based on the given XML stream. The stream may only contain UTF-8 data.
public load ( resource $xml, array $options = [] ) : array
$xml resource The XML stream of the message.
$options array Additional options when parsing the XML.
- relaxed: Relaxed error checking (default: false)
Résultat array The data array representing the object.
Exemple #1
0
 public function testRoundtripWithPreviousOnApiV1()
 {
     $xml = new Horde_Kolab_Format_Xml(new Horde_Kolab_Format_Xml_Parser(new DOMDocument('1.0', 'UTF-8')), new Horde_Kolab_Format_Factory(), array('version' => 1));
     $first = $xml->save(array('uid' => 1));
     $second = $xml->save($xml->load($first));
     $this->assertEquals($this->removeLastModification($first), $this->removeLastModification($second));
 }
Exemple #2
0
 /**
  * Load an object based on the given XML stream. The stream may only contain
  * UTF-8 data.
  *
  * @param resource $xml     The XML stream of the message.
  * @param array    $options Additional options when parsing the XML.
  * <pre>
  * - relaxed: Relaxed error checking (default: false)
  * </pre>
  *
  * @return array The data array representing the object.
  *
  * @throws Horde_Kolab_Format_Exception If parsing the XML data failed.
  *
  * @todo Check encoding of the returned array. It seems to be ISO-8859-1 at
  * the moment and UTF-8 would seem more appropriate.
  */
 public function load($xml, $options = array())
 {
     $object = parent::load($xml, $options);
     if ($object['end-date']['date-only']) {
         $object['end-date']['date']->add(new DateInterval('P1D'));
     }
     $object['start-date'] = $object['start-date']['date'];
     $object['end-date'] = $object['end-date']['date'];
     return $object;
 }