Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
AbstractPart | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
write | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
setParentWriter | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getParentWriter | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 |
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 | |
19 | namespace PhpOffice\PhpWord\Writer\HTML\Part; |
20 | |
21 | use PhpOffice\PhpWord\Exception\Exception; |
22 | use PhpOffice\PhpWord\Writer\HTML; |
23 | |
24 | /** |
25 | * @since 0.11.0 |
26 | */ |
27 | abstract class AbstractPart |
28 | { |
29 | /** |
30 | * @var ?HTML |
31 | */ |
32 | private $parentWriter; |
33 | |
34 | /** |
35 | * @return string |
36 | */ |
37 | abstract public function write(); |
38 | |
39 | public function setParentWriter(?HTML $writer = null): void |
40 | { |
41 | $this->parentWriter = $writer; |
42 | } |
43 | |
44 | /** |
45 | * @return HTML |
46 | */ |
47 | public function getParentWriter() |
48 | { |
49 | if ($this->parentWriter !== null) { |
50 | return $this->parentWriter; |
51 | } |
52 | |
53 | throw new Exception('No parent WriterInterface assigned.'); |
54 | } |
55 | } |