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
CheckBox
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%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 setName
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getName
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\Shared\Text as SharedText;
22
23/**
24 * Check box element.
25 *
26 * @since 0.10.0
27 */
28class CheckBox extends Text
29{
30    /**
31     * Name content.
32     *
33     * @var string
34     */
35    private $name;
36
37    /**
38     * Create new instance.
39     *
40     * @param string $name
41     * @param string $text
42     * @param mixed $fontStyle
43     * @param mixed $paragraphStyle
44     */
45    public function __construct($name = null, $text = null, $fontStyle = null, $paragraphStyle = null)
46    {
47        $this->setName($name);
48        parent::__construct($text, $fontStyle, $paragraphStyle);
49    }
50
51    /**
52     * Set name content.
53     *
54     * @param string $name
55     *
56     * @return self
57     */
58    public function setName($name)
59    {
60        $this->name = SharedText::toUTF8($name);
61
62        return $this;
63    }
64
65    /**
66     * Get name content.
67     *
68     * @return string
69     */
70    public function getName()
71    {
72        return $this->name;
73    }
74}