1: <?php
2: /**
3: * A decorator to represent a Kolab object attribute that can only be written on
4: * object creation and is immutable afterwards.
5: *
6: * PHP version 5
7: *
8: * @category Kolab
9: * @package Kolab_Server
10: * @author Gunnar Wrobel <wrobel@pardus.de>
11: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
12: * @link http://pear.horde.org/index.php?package=Kolab_Server
13: */
14:
15: /**
16: * A decorator to represent a Kolab object attribute that can only be written on
17: * object creation and is immutable afterwards.
18: *
19: * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
20: *
21: * See the enclosed file COPYING for license information (LGPL). If you
22: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
23: *
24: * @category Kolab
25: * @package Kolab_Server
26: * @author Gunnar Wrobel <wrobel@pardus.de>
27: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
28: * @link http://pear.horde.org/index.php?package=Kolab_Server
29: */
30: class Horde_Kolab_Server_Object_Attribute_Single
31: extends Horde_Kolab_Server_Object_Attribute_Decorator
32: {
33: /**
34: * Return the value of this attribute.
35: *
36: * @return array The value(s) of this attribute.
37: */
38: public function value()
39: {
40: $value = $this->_attribute->value();
41: if (is_array($value)) {
42: return array_shift($value);
43: } else {
44: return $value;
45: }
46: }
47: }