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