Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
16 / 16 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
Numbering | |
100.00% |
16 / 16 |
|
100.00% |
6 / 6 |
9 | |
100.00% |
1 / 1 |
getNumId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setNumId | |
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 | |||
getLevels | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setLevels | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
4 |
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 | /** |
21 | * Numbering style. |
22 | * |
23 | * @see http://www.schemacentral.com/sc/ooxml/e-w_numbering.html |
24 | * @see http://www.schemacentral.com/sc/ooxml/e-w_abstractNum-1.html |
25 | * @see http://www.schemacentral.com/sc/ooxml/e-w_num-1.html |
26 | * @since 0.10.0 |
27 | */ |
28 | class Numbering extends AbstractStyle |
29 | { |
30 | /** |
31 | * Numbering definition instance ID. |
32 | * |
33 | * @var int |
34 | * |
35 | * @see http://www.schemacentral.com/sc/ooxml/e-w_num-1.html |
36 | */ |
37 | private $numId; |
38 | |
39 | /** |
40 | * Multilevel type singleLevel|multilevel|hybridMultilevel. |
41 | * |
42 | * @var string |
43 | * |
44 | * @see http://www.schemacentral.com/sc/ooxml/a-w_val-67.html |
45 | */ |
46 | private $type; |
47 | |
48 | /** |
49 | * Numbering levels. |
50 | * |
51 | * @var NumberingLevel[] |
52 | */ |
53 | private $levels = []; |
54 | |
55 | /** |
56 | * Get Id. |
57 | */ |
58 | public function getNumId(): ?int |
59 | { |
60 | return $this->numId; |
61 | } |
62 | |
63 | /** |
64 | * Set Id. |
65 | */ |
66 | public function setNumId(int $value): self |
67 | { |
68 | $this->numId = $this->setIntVal($value, $this->numId); |
69 | |
70 | return $this; |
71 | } |
72 | |
73 | /** |
74 | * Get multilevel type. |
75 | */ |
76 | public function getType(): ?string |
77 | { |
78 | return $this->type; |
79 | } |
80 | |
81 | /** |
82 | * Set multilevel type. |
83 | */ |
84 | public function setType(string $value): self |
85 | { |
86 | $enum = ['singleLevel', 'multilevel', 'hybridMultilevel']; |
87 | $this->type = $this->setEnumVal($value, $enum, $this->type); |
88 | |
89 | return $this; |
90 | } |
91 | |
92 | /** |
93 | * Get levels. |
94 | * |
95 | * @return NumberingLevel[] |
96 | */ |
97 | public function getLevels(): array |
98 | { |
99 | return $this->levels; |
100 | } |
101 | |
102 | /** |
103 | * Set multilevel type. |
104 | */ |
105 | public function setLevels(array $values): self |
106 | { |
107 | if (is_array($values)) { |
108 | foreach ($values as $key => $value) { |
109 | $numberingLevel = new NumberingLevel(); |
110 | if (is_array($value)) { |
111 | $numberingLevel->setStyleByArray($value); |
112 | $numberingLevel->setLevel($key); |
113 | } |
114 | $this->levels[$key] = $numberingLevel; |
115 | } |
116 | } |
117 | |
118 | return $this; |
119 | } |
120 | } |