Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
18 / 18 |
|
100.00% |
11 / 11 |
CRAP | |
100.00% |
1 / 1 |
SDT | |
100.00% |
18 / 18 |
|
100.00% |
11 / 11 |
11 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setType | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
getValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setValue | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getListItems | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setListItems | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getTag | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setTag | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getAlias | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAlias | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | /** |
4 | * This file is part of PHPWord - A pure PHP library for reading and writing |
5 | * word processing documents. |
6 | * |
7 | * PHPWord is free software distributed under the terms of the GNU Lesser |
8 | * General Public License version 3 as published by the Free Software Foundation. |
9 | * |
10 | * For the full copyright and license information, please read the LICENSE |
11 | * file that was distributed with this source code. For the full list of |
12 | * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. |
13 | * |
14 | * @see https://github.com/PHPOffice/PHPWord |
15 | * |
16 | * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
17 | */ |
18 | |
19 | namespace PhpOffice\PhpWord\Element; |
20 | |
21 | /** |
22 | * Structured document tag (SDT) element. |
23 | * |
24 | * @since 0.12.0 |
25 | */ |
26 | class SDT extends Text |
27 | { |
28 | /** |
29 | * Form field type: comboBox|dropDownList|date. |
30 | * |
31 | * @var string |
32 | */ |
33 | private $type; |
34 | |
35 | /** |
36 | * Value. |
37 | * |
38 | * @var null|bool|int|string |
39 | */ |
40 | private $value; |
41 | |
42 | /** |
43 | * CheckBox/DropDown list entries. |
44 | * |
45 | * @var array |
46 | */ |
47 | private $listItems = []; |
48 | |
49 | /** |
50 | * Alias. |
51 | * |
52 | * @var string |
53 | */ |
54 | private $alias; |
55 | |
56 | /** |
57 | * Tag. |
58 | * |
59 | * @var string |
60 | */ |
61 | private $tag; |
62 | |
63 | /** |
64 | * Create new instance. |
65 | * |
66 | * @param string $type |
67 | * @param mixed $fontStyle |
68 | * @param mixed $paragraphStyle |
69 | */ |
70 | public function __construct($type, $fontStyle = null, $paragraphStyle = null) |
71 | { |
72 | parent::__construct(null, $fontStyle, $paragraphStyle); |
73 | $this->setType($type); |
74 | } |
75 | |
76 | /** |
77 | * Get type. |
78 | * |
79 | * @return string |
80 | */ |
81 | public function getType() |
82 | { |
83 | return $this->type; |
84 | } |
85 | |
86 | /** |
87 | * Set type. |
88 | * |
89 | * @param string $value |
90 | * |
91 | * @return self |
92 | */ |
93 | public function setType($value) |
94 | { |
95 | $enum = ['plainText', 'comboBox', 'dropDownList', 'date']; |
96 | $this->type = $this->setEnumVal($value, $enum, 'comboBox'); |
97 | |
98 | return $this; |
99 | } |
100 | |
101 | /** |
102 | * Get value. |
103 | * |
104 | * @return null|bool|int|string |
105 | */ |
106 | public function getValue() |
107 | { |
108 | return $this->value; |
109 | } |
110 | |
111 | /** |
112 | * Set value. |
113 | * |
114 | * @param null|bool|int|string $value |
115 | * |
116 | * @return self |
117 | */ |
118 | public function setValue($value) |
119 | { |
120 | $this->value = $value; |
121 | |
122 | return $this; |
123 | } |
124 | |
125 | /** |
126 | * Get listItems. |
127 | * |
128 | * @return array |
129 | */ |
130 | public function getListItems() |
131 | { |
132 | return $this->listItems; |
133 | } |
134 | |
135 | /** |
136 | * Set listItems. |
137 | * |
138 | * @param array $value |
139 | * |
140 | * @return self |
141 | */ |
142 | public function setListItems($value) |
143 | { |
144 | $this->listItems = $value; |
145 | |
146 | return $this; |
147 | } |
148 | |
149 | /** |
150 | * Get tag. |
151 | * |
152 | * @return string |
153 | */ |
154 | public function getTag() |
155 | { |
156 | return $this->tag; |
157 | } |
158 | |
159 | /** |
160 | * Set tag. |
161 | * |
162 | * @param string $tag |
163 | * |
164 | * @return self |
165 | */ |
166 | public function setTag($tag) |
167 | { |
168 | $this->tag = $tag; |
169 | |
170 | return $this; |
171 | } |
172 | |
173 | /** |
174 | * Get alias. |
175 | * |
176 | * @return string |
177 | */ |
178 | public function getAlias() |
179 | { |
180 | return $this->alias; |
181 | } |
182 | |
183 | /** |
184 | * Set alias. |
185 | * |
186 | * @param string $alias |
187 | * |
188 | * @return self |
189 | */ |
190 | public function setAlias($alias) |
191 | { |
192 | $this->alias = $alias; |
193 | |
194 | return $this; |
195 | } |
196 | } |