1: <?php
2: /**
3: * An adapter for attributes that rely on two internal Kolab object attributes.
4: *
5: * PHP version 5
6: *
7: * @category Kolab
8: * @package Kolab_Server
9: * @author Gunnar Wrobel <wrobel@pardus.de>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
11: * @link http://pear.horde.org/index.php?package=Kolab_Server
12: */
13:
14: /**
15: * An adapter for attributes that rely on two internal Kolab object attributes.
16: *
17: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you
20: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21: *
22: * @category Kolab
23: * @package Kolab_Server
24: * @author Gunnar Wrobel <wrobel@pardus.de>
25: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
26: * @link http://pear.horde.org/index.php?package=Kolab_Server
27: */
28: class Horde_Kolab_Server_Structure_Attribute_Double
29: implements Horde_Kolab_Server_Structure_Attribute_Interface
30: {
31: /**
32: * The attribute names.
33: *
34: * @param array
35: */
36: protected $names;
37:
38: /**
39: * The object the attribute belongs to.
40: *
41: * @param Horde_Kolab_Server_Object_Interface
42: */
43: protected $object;
44:
45: /**
46: * Constructor
47: *
48: * @param Horde_Kolab_Server_Object_Interface $object The object
49: * this attribute belongs to.
50: * @param string $name The name of this attribute.
51: */
52: public function __construct(
53: Horde_Kolab_Server_Object_Interface $object,
54: array $names
55: ) {
56: $this->object = $object;
57: $this->names = $names;
58: }
59:
60: /**
61: * Return the internal attribute adapter.
62: *
63: * @return Horde_Kolab_Server_Object_Interface The object the attribute belongs to.
64: */
65: public function getObject()
66: {
67: return $this->object;
68: }
69:
70: /**
71: * Return the name of this attribute.
72: *
73: * @return string The name of this attribute.
74: */
75: public function getName()
76: {
77: return $this->names;
78: }
79:
80: /**
81: * Return the value of this attribute.
82: *
83: * @return array The value of the attribute
84: */
85: public function value()
86: {
87: return $this->object->getInternal($this->names);
88: }
89:
90: /**
91: * Return the new internal state for this attribute.
92: *
93: * @param array $changes The object data that should be updated.
94: *
95: * @return array The resulting internal state.
96: *
97: * @throws Horde_Kolab_Server_Exception If storing the value failed.
98: */
99: public function update(array $changes)
100: {
101: return array();
102: }
103: }