Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
ListItemRun | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
5 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
3 | |||
getStyle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getDepth | |
100.00% |
1 / 1 |
|
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 | use PhpOffice\PhpWord\Style\ListItem as ListItemStyle; |
21 | |
22 | /** |
23 | * List item element. |
24 | */ |
25 | class ListItemRun extends TextRun |
26 | { |
27 | /** |
28 | * @var string Container type |
29 | */ |
30 | protected $container = 'ListItemRun'; |
31 | |
32 | /** |
33 | * ListItem Style. |
34 | * |
35 | * @var ?\PhpOffice\PhpWord\Style\ListItem |
36 | */ |
37 | private $style; |
38 | |
39 | /** |
40 | * ListItem Depth. |
41 | * |
42 | * @var int |
43 | */ |
44 | private $depth; |
45 | |
46 | /** |
47 | * Create a new ListItem. |
48 | * |
49 | * @param int $depth |
50 | * @param null|array|string $listStyle |
51 | * @param mixed $paragraphStyle |
52 | */ |
53 | public function __construct($depth = 0, $listStyle = null, $paragraphStyle = null) |
54 | { |
55 | $this->depth = $depth; |
56 | |
57 | // Version >= 0.10.0 will pass numbering style name. Older version will use old method |
58 | if (null !== $listStyle && is_string($listStyle)) { |
59 | $this->style = new ListItemStyle($listStyle); |
60 | } else { |
61 | $this->style = $this->setNewStyle(new ListItemStyle(), $listStyle, true); |
62 | } |
63 | parent::__construct($paragraphStyle); |
64 | } |
65 | |
66 | /** |
67 | * Get ListItem style. |
68 | * |
69 | * @return ?\PhpOffice\PhpWord\Style\ListItem |
70 | */ |
71 | public function getStyle() |
72 | { |
73 | return $this->style; |
74 | } |
75 | |
76 | /** |
77 | * Get ListItem depth. |
78 | * |
79 | * @return int |
80 | */ |
81 | public function getDepth() |
82 | { |
83 | return $this->depth; |
84 | } |
85 | } |