XmlFileToXmlTrait::validateSchema()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
1
<?php
2
3
namespace Magium\Configuration\File;
4
5
use Magium\Configuration\Config\MergedStructure;
6
7
trait XmlFileToXmlTrait
8
{
9
10
    protected $xml;
11
12
    abstract public function getFile();
13
14
    abstract public function validateSchema(\DOMDocument $doc);
15
16 15
    public function toXml()
17
    {
18 15
        if (!$this->xml instanceof MergedStructure) {
19 15
            $file = $this->getFile();
20 15
            $content = file_get_contents($file);
21 15
            $doc = new \DOMDocument();
22 15
            $doc->loadXML($content);
23 15
            $this->validateSchema($doc);
24 14
            $this->xml = new MergedStructure($content);
25
        }
26 14
        return $this->xml;
27
    }
28
29
}
30