Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
42 / 42 |
|
100.00% |
26 / 26 |
CRAP | |
100.00% |
1 / 1 |
NumberingLevel | |
100.00% |
42 / 42 |
|
100.00% |
26 / 26 |
27 | |
100.00% |
1 / 1 |
getLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setLevel | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getStart | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setStart | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getFormat | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setFormat | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getRestart | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setRestart | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getPStyle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setPStyle | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getSuffix | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setSuffix | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
getText | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setText | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getAlignment | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setAlignment | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
getLeft | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setLeft | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getHanging | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setHanging | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getTabPos | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setTabPos | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getFont | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setFont | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getHint | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setHint | |
100.00% |
3 / 3 |
|
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\Style; |
19 | |
20 | use PhpOffice\PhpWord\SimpleType\Jc; |
21 | use PhpOffice\PhpWord\SimpleType\NumberFormat; |
22 | |
23 | /** |
24 | * Numbering level definition. |
25 | * |
26 | * @see http://www.schemacentral.com/sc/ooxml/e-w_lvl-1.html |
27 | * @since 0.10.0 |
28 | */ |
29 | class NumberingLevel extends AbstractStyle |
30 | { |
31 | /** |
32 | * Level number, 0 to 8 (total 9 levels). |
33 | * |
34 | * @var int |
35 | */ |
36 | private $level = 0; |
37 | |
38 | /** |
39 | * Starting value w:start. |
40 | * |
41 | * @var int |
42 | * |
43 | * @see http://www.schemacentral.com/sc/ooxml/e-w_start-1.html |
44 | */ |
45 | private $start = 1; |
46 | |
47 | /** |
48 | * Numbering format w:numFmt, one of PhpOffice\PhpWord\SimpleType\NumberFormat. |
49 | * |
50 | * @var string |
51 | * |
52 | * @see http://www.schemacentral.com/sc/ooxml/t-w_ST_NumberFormat.html |
53 | */ |
54 | private $format; |
55 | |
56 | /** |
57 | * Restart numbering level symbol w:lvlRestart. |
58 | * |
59 | * @var int |
60 | * |
61 | * @see http://www.schemacentral.com/sc/ooxml/e-w_lvlRestart-1.html |
62 | */ |
63 | private $restart; |
64 | |
65 | /** |
66 | * Related paragraph style. |
67 | * |
68 | * @var string |
69 | * |
70 | * @see http://www.schemacentral.com/sc/ooxml/e-w_pStyle-2.html |
71 | */ |
72 | private $pStyle; |
73 | |
74 | /** |
75 | * Content between numbering symbol and paragraph text w:suff. |
76 | * |
77 | * @var string tab|space|nothing |
78 | * |
79 | * @see http://www.schemacentral.com/sc/ooxml/e-w_suff-1.html |
80 | */ |
81 | private $suffix = 'tab'; |
82 | |
83 | /** |
84 | * Numbering level text e.g. %1 for nonbullet or bullet character. |
85 | * |
86 | * @var string |
87 | * |
88 | * @see http://www.schemacentral.com/sc/ooxml/e-w_lvlText-1.html |
89 | */ |
90 | private $text; |
91 | |
92 | /** |
93 | * Justification, w:lvlJc. |
94 | * |
95 | * @var string, one of PhpOffice\PhpWord\SimpleType\Jc |
96 | */ |
97 | private $alignment = ''; |
98 | |
99 | /** |
100 | * Left. |
101 | * |
102 | * @var int |
103 | */ |
104 | private $left; |
105 | |
106 | /** |
107 | * Hanging. |
108 | * |
109 | * @var int |
110 | */ |
111 | private $hanging; |
112 | |
113 | /** |
114 | * Tab position. |
115 | * |
116 | * @var int |
117 | */ |
118 | private $tabPos; |
119 | |
120 | /** |
121 | * Font family. |
122 | * |
123 | * @var string |
124 | */ |
125 | private $font; |
126 | |
127 | /** |
128 | * Hint default|eastAsia|cs. |
129 | * |
130 | * @var string |
131 | * |
132 | * @see http://www.schemacentral.com/sc/ooxml/a-w_hint-1.html |
133 | */ |
134 | private $hint; |
135 | |
136 | /** |
137 | * Get level. |
138 | * |
139 | * @return int |
140 | */ |
141 | public function getLevel() |
142 | { |
143 | return $this->level; |
144 | } |
145 | |
146 | /** |
147 | * Set level. |
148 | * |
149 | * @param int $value |
150 | * |
151 | * @return self |
152 | */ |
153 | public function setLevel($value) |
154 | { |
155 | $this->level = $this->setIntVal($value, $this->level); |
156 | |
157 | return $this; |
158 | } |
159 | |
160 | /** |
161 | * Get start. |
162 | * |
163 | * @return int |
164 | */ |
165 | public function getStart() |
166 | { |
167 | return $this->start; |
168 | } |
169 | |
170 | /** |
171 | * Set start. |
172 | * |
173 | * @param int $value |
174 | * |
175 | * @return self |
176 | */ |
177 | public function setStart($value) |
178 | { |
179 | $this->start = $this->setIntVal($value, $this->start); |
180 | |
181 | return $this; |
182 | } |
183 | |
184 | /** |
185 | * Get format. |
186 | * |
187 | * @return string |
188 | */ |
189 | public function getFormat() |
190 | { |
191 | return $this->format; |
192 | } |
193 | |
194 | /** |
195 | * Set format. |
196 | * |
197 | * @param string $value |
198 | * |
199 | * @return self |
200 | */ |
201 | public function setFormat($value) |
202 | { |
203 | $this->format = $this->setEnumVal($value, NumberFormat::values(), $this->format); |
204 | |
205 | return $this; |
206 | } |
207 | |
208 | /** |
209 | * Get restart. |
210 | * |
211 | * @return int |
212 | */ |
213 | public function getRestart() |
214 | { |
215 | return $this->restart; |
216 | } |
217 | |
218 | /** |
219 | * Set restart. |
220 | * |
221 | * @param int $value |
222 | * |
223 | * @return self |
224 | */ |
225 | public function setRestart($value) |
226 | { |
227 | $this->restart = $this->setIntVal($value, $this->restart); |
228 | |
229 | return $this; |
230 | } |
231 | |
232 | /** |
233 | * Get related paragraph style. |
234 | * |
235 | * @return string |
236 | */ |
237 | public function getPStyle() |
238 | { |
239 | return $this->pStyle; |
240 | } |
241 | |
242 | /** |
243 | * Set related paragraph style. |
244 | * |
245 | * @param string $value |
246 | * |
247 | * @return self |
248 | */ |
249 | public function setPStyle($value) |
250 | { |
251 | $this->pStyle = $value; |
252 | |
253 | return $this; |
254 | } |
255 | |
256 | /** |
257 | * Get suffix. |
258 | * |
259 | * @return string |
260 | */ |
261 | public function getSuffix() |
262 | { |
263 | return $this->suffix; |
264 | } |
265 | |
266 | /** |
267 | * Set suffix. |
268 | * |
269 | * @param string $value |
270 | * |
271 | * @return self |
272 | */ |
273 | public function setSuffix($value) |
274 | { |
275 | $enum = ['tab', 'space', 'nothing']; |
276 | $this->suffix = $this->setEnumVal($value, $enum, $this->suffix); |
277 | |
278 | return $this; |
279 | } |
280 | |
281 | /** |
282 | * Get text. |
283 | * |
284 | * @return string |
285 | */ |
286 | public function getText() |
287 | { |
288 | return $this->text; |
289 | } |
290 | |
291 | /** |
292 | * Set text. |
293 | * |
294 | * @param string $value |
295 | * |
296 | * @return self |
297 | */ |
298 | public function setText($value) |
299 | { |
300 | $this->text = $value; |
301 | |
302 | return $this; |
303 | } |
304 | |
305 | /** |
306 | * @since 0.13.0 |
307 | * |
308 | * @return string |
309 | */ |
310 | public function getAlignment() |
311 | { |
312 | return $this->alignment; |
313 | } |
314 | |
315 | /** |
316 | * @since 0.13.0 |
317 | * |
318 | * @param string $value |
319 | * |
320 | * @return self |
321 | */ |
322 | public function setAlignment($value) |
323 | { |
324 | if (Jc::isValid($value)) { |
325 | $this->alignment = $value; |
326 | } |
327 | |
328 | return $this; |
329 | } |
330 | |
331 | /** |
332 | * Get left. |
333 | * |
334 | * @return int |
335 | */ |
336 | public function getLeft() |
337 | { |
338 | return $this->left; |
339 | } |
340 | |
341 | /** |
342 | * Set left. |
343 | * |
344 | * @param int $value |
345 | * |
346 | * @return self |
347 | */ |
348 | public function setLeft($value) |
349 | { |
350 | $this->left = $this->setIntVal($value, $this->left); |
351 | |
352 | return $this; |
353 | } |
354 | |
355 | /** |
356 | * Get hanging. |
357 | * |
358 | * @return int |
359 | */ |
360 | public function getHanging() |
361 | { |
362 | return $this->hanging; |
363 | } |
364 | |
365 | /** |
366 | * Set hanging. |
367 | * |
368 | * @param int $value |
369 | * |
370 | * @return self |
371 | */ |
372 | public function setHanging($value) |
373 | { |
374 | $this->hanging = $this->setIntVal($value, $this->hanging); |
375 | |
376 | return $this; |
377 | } |
378 | |
379 | /** |
380 | * Get tab. |
381 | * |
382 | * @return int |
383 | */ |
384 | public function getTabPos() |
385 | { |
386 | return $this->tabPos; |
387 | } |
388 | |
389 | /** |
390 | * Set tab. |
391 | * |
392 | * @param int $value |
393 | * |
394 | * @return self |
395 | */ |
396 | public function setTabPos($value) |
397 | { |
398 | $this->tabPos = $this->setIntVal($value, $this->tabPos); |
399 | |
400 | return $this; |
401 | } |
402 | |
403 | /** |
404 | * Get font. |
405 | * |
406 | * @return string |
407 | */ |
408 | public function getFont() |
409 | { |
410 | return $this->font; |
411 | } |
412 | |
413 | /** |
414 | * Set font. |
415 | * |
416 | * @param string $value |
417 | * |
418 | * @return self |
419 | */ |
420 | public function setFont($value) |
421 | { |
422 | $this->font = $value; |
423 | |
424 | return $this; |
425 | } |
426 | |
427 | /** |
428 | * Get hint. |
429 | * |
430 | * @return string |
431 | */ |
432 | public function getHint() |
433 | { |
434 | return $this->hint; |
435 | } |
436 | |
437 | /** |
438 | * Set hint. |
439 | * |
440 | * @param string $value |
441 | * |
442 | * @return self |
443 | */ |
444 | public function setHint($value = null) |
445 | { |
446 | $enum = ['default', 'eastAsia', 'cs']; |
447 | $this->hint = $this->setEnumVal($value, $enum, $this->hint); |
448 | |
449 | return $this; |
450 | } |
451 | } |