Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
14 / 14 |
|
100.00% |
9 / 9 |
CRAP | |
100.00% |
1 / 1 |
LineNumbering | |
100.00% |
14 / 14 |
|
100.00% |
9 / 9 |
9 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
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 | |||
getIncrement | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setIncrement | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getDistance | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setDistance | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getRestart | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setRestart | |
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 | /** |
21 | * Line numbering style. |
22 | * |
23 | * @see http://www.schemacentral.com/sc/ooxml/t-w_CT_LineNumber.html |
24 | * @since 0.10.0 |
25 | */ |
26 | class LineNumbering extends AbstractStyle |
27 | { |
28 | /** @const string Line numbering restart setting http://www.schemacentral.com/sc/ooxml/a-w_restart-1.html */ |
29 | const LINE_NUMBERING_CONTINUOUS = 'continuous'; |
30 | const LINE_NUMBERING_NEW_PAGE = 'newPage'; |
31 | const LINE_NUMBERING_NEW_SECTION = 'newSection'; |
32 | |
33 | /** |
34 | * Line numbering starting value. |
35 | * |
36 | * @var int |
37 | */ |
38 | private $start = 1; |
39 | |
40 | /** |
41 | * Line number increments. |
42 | * |
43 | * @var int |
44 | */ |
45 | private $increment = 1; |
46 | |
47 | /** |
48 | * Distance between text and line numbering in twip. |
49 | * |
50 | * @var float|int |
51 | */ |
52 | private $distance; |
53 | |
54 | /** |
55 | * Line numbering restart setting continuous|newPage|newSection. |
56 | * |
57 | * @var string |
58 | * |
59 | * @see http://www.schemacentral.com/sc/ooxml/a-w_restart-1.html |
60 | */ |
61 | private $restart; |
62 | |
63 | /** |
64 | * Create a new instance. |
65 | * |
66 | * @param array $style |
67 | */ |
68 | public function __construct($style = []) |
69 | { |
70 | $this->setStyleByArray($style); |
71 | } |
72 | |
73 | /** |
74 | * Get start. |
75 | * |
76 | * @return int |
77 | */ |
78 | public function getStart() |
79 | { |
80 | return $this->start; |
81 | } |
82 | |
83 | /** |
84 | * Set start. |
85 | * |
86 | * @param int $value |
87 | * |
88 | * @return self |
89 | */ |
90 | public function setStart($value = null) |
91 | { |
92 | $this->start = $this->setIntVal($value, $this->start); |
93 | |
94 | return $this; |
95 | } |
96 | |
97 | /** |
98 | * Get increment. |
99 | * |
100 | * @return int |
101 | */ |
102 | public function getIncrement() |
103 | { |
104 | return $this->increment; |
105 | } |
106 | |
107 | /** |
108 | * Set increment. |
109 | * |
110 | * @param int $value |
111 | * |
112 | * @return self |
113 | */ |
114 | public function setIncrement($value = null) |
115 | { |
116 | $this->increment = $this->setIntVal($value, $this->increment); |
117 | |
118 | return $this; |
119 | } |
120 | |
121 | /** |
122 | * Get distance. |
123 | * |
124 | * @return float|int |
125 | */ |
126 | public function getDistance() |
127 | { |
128 | return $this->distance; |
129 | } |
130 | |
131 | /** |
132 | * Set distance. |
133 | * |
134 | * @param float|int $value |
135 | * |
136 | * @return self |
137 | */ |
138 | public function setDistance($value = null) |
139 | { |
140 | $this->distance = $this->setNumericVal($value, $this->distance); |
141 | |
142 | return $this; |
143 | } |
144 | |
145 | /** |
146 | * Get restart. |
147 | * |
148 | * @return string |
149 | */ |
150 | public function getRestart() |
151 | { |
152 | return $this->restart; |
153 | } |
154 | |
155 | /** |
156 | * Set distance. |
157 | * |
158 | * @param string $value |
159 | * |
160 | * @return self |
161 | */ |
162 | public function setRestart($value = null) |
163 | { |
164 | $enum = [self::LINE_NUMBERING_CONTINUOUS, self::LINE_NUMBERING_NEW_PAGE, self::LINE_NUMBERING_NEW_SECTION]; |
165 | $this->restart = $this->setEnumVal($value, $enum, $this->restart); |
166 | |
167 | return $this; |
168 | } |
169 | } |