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