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

XmlFile   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

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