Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractElement
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 write
n/a
0 / 0
n/a
0 / 0
0
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 setWithoutP
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\Writer\HTML\Element;
20
21use PhpOffice\PhpWord\Element\AbstractElement as Element;
22use PhpOffice\PhpWord\Writer\HTML;
23
24/**
25 * Abstract HTML element writer.
26 *
27 * @since 0.11.0
28 */
29abstract class AbstractElement
30{
31    /**
32     * Parent writer.
33     *
34     * @var HTML
35     */
36    protected $parentWriter;
37
38    /**
39     * Element.
40     *
41     * @var Element
42     */
43    protected $element;
44
45    /**
46     * Without paragraph.
47     *
48     * @var bool
49     */
50    protected $withoutP = false;
51
52    /**
53     * Write element.
54     */
55    abstract public function write();
56
57    /**
58     * Create new instance.
59     *
60     * @param bool $withoutP
61     */
62    public function __construct(HTML $parentWriter, Element $element, $withoutP = false)
63    {
64        $this->parentWriter = $parentWriter;
65        $this->element = $element;
66        $this->withoutP = $withoutP;
67    }
68
69    /**
70     * Set without paragraph.
71     *
72     * @param bool $value
73     */
74    public function setWithoutP($value): void
75    {
76        $this->withoutP = $value;
77    }
78}