Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
9 / 9 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
Row | |
100.00% |
9 / 9 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
addCell | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
getCells | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getStyle | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getHeight | |
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\Row as RowStyle; |
21 | |
22 | /** |
23 | * Table row element. |
24 | * |
25 | * @since 0.8.0 |
26 | */ |
27 | class Row extends AbstractElement |
28 | { |
29 | /** |
30 | * Row height. |
31 | * |
32 | * @var ?int |
33 | */ |
34 | private $height; |
35 | |
36 | /** |
37 | * Row style. |
38 | * |
39 | * @var ?\PhpOffice\PhpWord\Style\Row |
40 | */ |
41 | private $style; |
42 | |
43 | /** |
44 | * Row cells. |
45 | * |
46 | * @var \PhpOffice\PhpWord\Element\Cell[] |
47 | */ |
48 | private $cells = []; |
49 | |
50 | /** |
51 | * Create a new table row. |
52 | * |
53 | * @param int $height |
54 | * @param mixed $style |
55 | */ |
56 | public function __construct($height = null, $style = null) |
57 | { |
58 | $this->height = $height; |
59 | $this->style = $this->setNewStyle(new RowStyle(), $style, true); |
60 | } |
61 | |
62 | /** |
63 | * Add a cell. |
64 | * |
65 | * @param int $width |
66 | * @param mixed $style |
67 | * |
68 | * @return \PhpOffice\PhpWord\Element\Cell |
69 | */ |
70 | public function addCell($width = null, $style = null) |
71 | { |
72 | $cell = new Cell($width, $style); |
73 | $cell->setParentContainer($this); |
74 | $this->cells[] = $cell; |
75 | |
76 | return $cell; |
77 | } |
78 | |
79 | /** |
80 | * Get all cells. |
81 | * |
82 | * @return \PhpOffice\PhpWord\Element\Cell[] |
83 | */ |
84 | public function getCells() |
85 | { |
86 | return $this->cells; |
87 | } |
88 | |
89 | /** |
90 | * Get row style. |
91 | * |
92 | * @return ?\PhpOffice\PhpWord\Style\Row |
93 | */ |
94 | public function getStyle() |
95 | { |
96 | return $this->style; |
97 | } |
98 | |
99 | /** |
100 | * Get row height. |
101 | * |
102 | * @return ?int |
103 | */ |
104 | public function getHeight() |
105 | { |
106 | return $this->height; |
107 | } |
108 | } |