Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
80.00% |
4 / 5 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
AbstractPart | |
80.00% |
4 / 5 |
|
66.67% |
2 / 3 |
4.13 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
write | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
setParentWriter | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getParentWriter | |
66.67% |
2 / 3 |
|
0.00% |
0 / 1 |
2.15 |
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 | |
18 | namespace PhpOffice\PhpWord\Writer\RTF\Part; |
19 | |
20 | use PhpOffice\PhpWord\Escaper\Rtf; |
21 | use PhpOffice\PhpWord\Exception\Exception; |
22 | use PhpOffice\PhpWord\Writer\AbstractWriter; |
23 | |
24 | /** |
25 | * @since 0.11.0 |
26 | */ |
27 | abstract class AbstractPart |
28 | { |
29 | /** |
30 | * @var \PhpOffice\PhpWord\Writer\RTF |
31 | */ |
32 | private $parentWriter; |
33 | |
34 | /** |
35 | * @var \PhpOffice\PhpWord\Escaper\EscaperInterface |
36 | */ |
37 | protected $escaper; |
38 | |
39 | public function __construct() |
40 | { |
41 | $this->escaper = new Rtf(); |
42 | } |
43 | |
44 | /** |
45 | * @return string |
46 | */ |
47 | abstract public function write(); |
48 | |
49 | /** |
50 | * @param \PhpOffice\PhpWord\Writer\RTF $writer |
51 | */ |
52 | public function setParentWriter(?AbstractWriter $writer = null): void |
53 | { |
54 | $this->parentWriter = $writer; |
55 | } |
56 | |
57 | /** |
58 | * @return \PhpOffice\PhpWord\Writer\RTF |
59 | */ |
60 | public function getParentWriter() |
61 | { |
62 | if ($this->parentWriter !== null) { |
63 | return $this->parentWriter; |
64 | } |
65 | |
66 | throw new Exception('No parent WriterInterface assigned.'); |
67 | } |
68 | } |