1
|
|
|
<?php |
2
|
|
|
namespace Dkd\PhpCmis\DataObjects; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* This file is part of php-cmis-lib. |
6
|
|
|
* |
7
|
|
|
* (c) Sascha Egerer <[email protected]> |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
10
|
|
|
* file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
use Dkd\PhpCmis\Definitions\ChoiceInterface; |
14
|
|
|
use Dkd\PhpCmis\Traits\TypeHelperTrait; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Choice implementation. |
18
|
|
|
*/ |
19
|
|
|
class Choice implements ChoiceInterface |
20
|
|
|
{ |
21
|
|
|
use TypeHelperTrait; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
protected $displayName = ''; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var ChoiceInterface[]|string[]|integer[]|boolean[]|float[]|\DateTime[] |
30
|
|
|
*/ |
31
|
|
|
protected $value = array(); |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var ChoiceInterface[] |
35
|
|
|
*/ |
36
|
|
|
protected $choices = array(); |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return ChoiceInterface[] |
40
|
|
|
*/ |
41
|
1 |
|
public function getChoices() |
42
|
|
|
{ |
43
|
1 |
|
return $this->choices; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param ChoiceInterface[] $choices |
48
|
|
|
*/ |
49
|
3 |
|
public function setChoices(array $choices) |
50
|
|
|
{ |
51
|
3 |
|
foreach ($choices as $value) { |
52
|
3 |
|
$this->checkType('\\Dkd\\PhpCmis\\Definitions\\ChoiceInterface', $value); |
53
|
3 |
|
} |
54
|
|
|
|
55
|
2 |
|
$this->choices = $choices; |
56
|
2 |
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Return the display name of the choice value. |
60
|
|
|
* |
61
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
1 |
|
public function getDisplayName() |
64
|
|
|
{ |
65
|
1 |
|
return $this->displayName; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Sets the display name of the choice value. |
70
|
|
|
* |
71
|
|
|
* @return string $displayName |
72
|
|
|
*/ |
73
|
2 |
|
public function setDisplayName($displayName) |
74
|
|
|
{ |
75
|
2 |
|
$this->checkType('string', $displayName); |
76
|
2 |
|
$this->displayName = $displayName; |
77
|
2 |
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Return the value of the choice value. |
81
|
|
|
* |
82
|
|
|
* @return ChoiceInterface[]|string[]|integer[]|boolean[]|float[]|\DateTime[] |
83
|
|
|
*/ |
84
|
1 |
|
public function getValue() |
85
|
|
|
{ |
86
|
1 |
|
return $this->value; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Sets the value of the choice value. |
91
|
|
|
* |
92
|
|
|
* @param ChoiceInterface[]|string[]|integer[]|boolean[]|float[]|\DateTime[] $value |
93
|
|
|
*/ |
94
|
2 |
|
public function setValue(array $value) |
95
|
|
|
{ |
96
|
2 |
|
$this->value = $value; |
97
|
2 |
|
} |
98
|
|
|
} |
99
|
|
|
|