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