Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
TblWidth
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getValue
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\ComplexType;
19
20use PhpOffice\PhpWord\SimpleType\TblWidth as TblWidthSimpleType;
21
22/**
23 * @see http://www.datypic.com/sc/ooxml/t-w_CT_TblWidth.html
24 */
25final class TblWidth
26{
27    /** @var string */
28    private $type;
29
30    /** @var int */
31    private $value;
32
33    /**
34     * @param int $value If omitted, then its value shall be assumed to be 0
35     * @param string $type If omitted, then its value shall be assumed to be dxa
36     */
37    public function __construct($value = 0, $type = TblWidthSimpleType::TWIP)
38    {
39        $this->value = $value;
40        TblWidthSimpleType::validate($type);
41        $this->type = $type;
42    }
43
44    /**
45     * @return string
46     */
47    public function getType()
48    {
49        return $this->type;
50    }
51
52    /**
53     * @return int
54     */
55    public function getValue()
56    {
57        return $this->value;
58    }
59}