Passed
Push — master ( 39863f...ab2034 )
by Radu
01:42
created

XmlFile::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 3
1
<?php
2
namespace WebServCo\Framework\Files;
3
4
final class XmlFile extends AbstractFile
5
{
6
    public function __construct(string $fileName, string $fileData, $formatOutput = false)
7
    {
8
        $domDocument = new \DOMDocument;
9
        if ($formatOutput) {
10
            $domDocument->preserveWhiteSpace = false;
11
            $domDocument->formatOutput = true;
12
        }
13
        $domDocument->loadXML($fileData);
14
        $fileData = $domDocument->saveXML();
15
16
        parent::__construct($fileName, $fileData, 'text/xml');
17
    }
18
}
19