protected function appendDefects(\DOMElement $caseNode, array $defects, string $type)
    {
        foreach ($defects as $defect) {
            $defectNode = $this->document->createElement($type, htmlspecialchars($defect['text'], ENT_XML1) . "\n");
            $defectNode->setAttribute('type', $defect['type']);
            $caseNode->appendChild($defectNode);
        }
    }