Passed
Push — master ( fc83aa...c68055 )
by Radu
01:36
created

XmlFileFromDomElement::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 3
1
<?php
2
namespace WebServCo\Framework\Files;
3
4
final class XmlFileFromDomElement extends AbstractFile implements \WebServCo\Framework\Interfaces\FileInterface
5
{
6
    public function __construct($fileName, \DOMElement $domElement, $formatOutput = false)
7
    {
8
        $domDocument = new \DOMDocument;
9
        $domDocument->preserveWhiteSpace = false;
10
        if ($formatOutput) {
11
            $domDocument->formatOutput = true;
12
        }
13
        $domDocument->appendChild($domElement);
14
        $fileData = $domDocument->saveXML();
15
        $domDocument = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $domDocument is dead and can be removed.
Loading history...
16
17
        parent::__construct($fileName, $fileData, XmlFile::CONTENT_TYPE);
18
    }
19
}
20