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

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