Code Duplication    Length = 12-12 lines in 2 locations

src/Rules/Xml/XmlCheckRule.php 1 location

@@ 16-27 (lines=12) @@
13
{
14
    protected $contentTypes = array('text/xml', 'application/xml');
15
16
    public function doValidation(Response $response)
17
    {
18
        $domDocument = new \DOMDocument();
19
        $success = @$domDocument->loadXML((string) $response->getBody());
20
21
        if (!$success) {
22
            $lastError = libxml_get_last_error();
23
24
            throw new ValidationFailedException('The xml file ' . $response->getUri() . ' is not well formed (last error: ' .
25
                str_replace("\n", '', $lastError->message) . ').');
26
        }
27
    }
28
}
29

src/Rules/Xml/Sitemap/ValidRule.php 1 location

@@ 40-51 (lines=12) @@
37
        }
38
    }
39
40
    private function validateBody($body, $filename, $isIndex = TRUE)
41
    {
42
        $dom = new \DOMDocument();
43
        @$dom->loadXML($body);
44
45
        $valid = @$dom->schemaValidate($this->getSchema($isIndex));
46
        if (!$valid) {
47
            $lastError = libxml_get_last_error();
48
            throw new ValidationFailedException(
49
                'The given sitemap file (' . $filename . ') did not validate against the sitemap schema (last error: ' . str_replace("\n", '', $lastError->message) . ').');
50
        }
51
    }
52
53
    /**
54
     * @param string