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