DomDocumentTrait::getDefaultDomConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 11
ccs 9
cts 9
cp 1
crap 1
rs 10
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
Protected member variable "domDocument" must contain a leading underscore
Loading history...
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