1 | <?php |
||
2 | /** |
||
3 | * Copyright (c) 2010–2019 Ryan Parman <http://ryanparman.com>. |
||
4 | * Copyright (c) 2016–2019 Contributors. |
||
5 | * |
||
6 | * http://opensource.org/licenses/Apache2.0 |
||
7 | */ |
||
8 | |||
9 | declare(strict_types=1); |
||
10 | |||
11 | namespace SimplePie\UtilityPack\Mixin; |
||
12 | |||
13 | use DOMDocument; |
||
14 | |||
15 | /** |
||
16 | * Shared code for working with `DOMDocument` objects. |
||
17 | */ |
||
18 | trait DomDocumentTrait |
||
19 | { |
||
20 | /** |
||
21 | * The DOMDocument object which is being used to parse the content. |
||
22 | * |
||
23 | * @var DOMDocument |
||
24 | */ |
||
25 | protected $domDocument; |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
26 | |||
27 | /** |
||
28 | * Gets the DOMDocument object which is being used to parse the content. |
||
29 | */ |
||
30 | 1 | public function getDomDocument(): DOMDocument |
|
31 | { |
||
32 | 1 | return $this->domDocument; |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * Gets the default (preferred) configuration for DOMDocument. |
||
37 | */ |
||
38 | 1 | public function getDefaultDomConfig(DOMDocument $domDocument): DOMDocument |
|
39 | { |
||
40 | 1 | $domDocument->recover = true; |
|
41 | 1 | $domDocument->formatOutput = false; |
|
42 | 1 | $domDocument->preserveWhiteSpace = false; |
|
43 | 1 | $domDocument->resolveExternals = true; |
|
44 | 1 | $domDocument->substituteEntities = true; |
|
45 | 1 | $domDocument->strictErrorChecking = false; |
|
46 | 1 | $domDocument->validateOnParse = false; |
|
47 | |||
48 | 1 | return $domDocument; |
|
49 | } |
||
50 | } |
||
51 |