Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
Cell
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
3 / 3
3
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
 getStyle
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWidth
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
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
18namespace PhpOffice\PhpWord\Element;
19
20use PhpOffice\PhpWord\Style\Cell as CellStyle;
21
22/**
23 * Table cell element.
24 */
25class Cell extends AbstractContainer
26{
27    /**
28     * @var string Container type
29     */
30    protected $container = 'Cell';
31
32    /**
33     * Cell width.
34     *
35     * @var ?int
36     */
37    private $width;
38
39    /**
40     * Cell style.
41     *
42     * @var ?\PhpOffice\PhpWord\Style\Cell
43     */
44    private $style;
45
46    /**
47     * Create new instance.
48     *
49     * @param null|int $width
50     * @param array|\PhpOffice\PhpWord\Style\Cell $style
51     */
52    public function __construct($width = null, $style = null)
53    {
54        $this->width = $width;
55        $this->style = $this->setNewStyle(new CellStyle(), $style, true);
56    }
57
58    /**
59     * Get cell style.
60     *
61     * @return ?\PhpOffice\PhpWord\Style\Cell
62     */
63    public function getStyle()
64    {
65        return $this->style;
66    }
67
68    /**
69     * Get cell width.
70     *
71     * @return ?int
72     */
73    public function getWidth()
74    {
75        return $this->width;
76    }
77}