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

XmlFileFromDomElement   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 2
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