Code Duplication    Length = 10-12 lines in 2 locations

src/Service/DomHelper.php 2 locations

@@ 14-23 (lines=10) @@
11
12
class DomHelper
13
{
14
    public function loadDocument(string $pathToXml): DOMDocument
15
    {
16
        if (!file_exists($pathToXml)) {
17
            throw new RuntimeException(sprintf('File %s does not exist', $pathToXml));
18
        }
19
20
        $document = $this->createEmptyDomDocument();
21
        $this->loadXmlContents($document, $pathToXml);
22
        return $document;
23
    }
24
25
    public function loadOrCreateDocument(string $pathToXml): DOMDocument
26
    {
@@ 25-36 (lines=12) @@
22
        return $document;
23
    }
24
25
    public function loadOrCreateDocument(string $pathToXml): DOMDocument
26
    {
27
        $document = $this->createEmptyDomDocument();
28
29
        if (!file_exists($pathToXml)) {
30
            return $document;
31
        }
32
33
        $this->loadXmlContents($document, $pathToXml);
34
35
        return $document;
36
    }
37
38
    private function createEmptyDomDocument(): DOMDocument
39
    {