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