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