1: <?php
2: /**
3: * A Kolab XML envelope for arbitrary XML.
4: *
5: * PHP version 5
6: *
7: * @category Kolab
8: * @package Kolab_Format
9: * @author Gunnar Wrobel <wrobel@pardus.de>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
11: * @link http://www.horde.org/libraries/Horde_Kolab_Format
12: */
13:
14: /**
15: * A Kolab XML envelope for arbitrary XML.
16: *
17: * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you did not
20: * receive this file, see
21: * http://www.horde.org/licenses/lgpl21.
22: *
23: * @category Kolab
24: * @package Kolab_Format
25: * @author Gunnar Wrobel <wrobel@pardus.de>
26: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
27: * @link http://www.horde.org/libraries/Horde_Kolab_Format
28: */
29: class Horde_Kolab_Format_Xml_Envelope extends Horde_Kolab_Format_Xml
30: {
31: /**
32: * Specific data fields for the prefs object
33: *
34: * @var Kolab
35: */
36: protected $_fields_specific = array(
37: 'xml' => 'Horde_Kolab_Format_Xml_Type_XmlAppend',
38: );
39:
40: /**
41: * Convert the data to a XML stream. Strings contained in the data array may
42: * only be provided as UTF-8 data.
43: *
44: * @param array $object The data array representing the object.
45: * @param array $options Additional options when parsing the XML.
46: * <pre>
47: * - previos: The previous XML text (default: empty string)
48: * - relaxed: Relaxed error checking (default: false)
49: * </pre>
50: *
51: * @return resource The data as XML stream.
52: *
53: * @throws Horde_Kolab_Format_Exception If converting the data to XML failed.
54: */
55: public function save($object, $options = array())
56: {
57: if (!isset($object['type'])) {
58: throw new Horde_Kolab_Format_Exception('The "type" value is missing!');
59: }
60: $this->_root_name = $object['type'];
61: return parent::save($object, $options);
62: }
63: }
64: