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