Code Duplication    Length = 3-3 lines in 2 locations

Serializer/Normalizer/ExceptionHandler.php 1 location

@@ 76-78 (lines=3) @@
73
    ) {
74
        $data = $this->convertToArray($exception, $context);
75
76
        if (null === $visitor->document) {
77
            $visitor->document = $visitor->createDocument(null, null, true);
78
        }
79
80
        foreach ($data as $key => $value) {
81
            $entryNode = $visitor->document->createElement($key);

Serializer/Normalizer/FormErrorHandler.php 1 location

@@ 44-46 (lines=3) @@
41
        if ($context) {
42
            $statusCode = $context->attributes->get('status_code');
43
            if ($statusCode->isDefined()) {
44
                if (null === $visitor->document) {
45
                    $visitor->document = $visitor->createDocument(null, null, true);
46
                }
47
48
                $codeNode = $visitor->document->createElement('code');
49
                $visitor->getCurrentNode()->appendChild($codeNode);