Code Duplication    Length = 6-6 lines in 2 locations

src/Entity/Annotation/Listener/Mapping/Property/TargetEntityAnnotationListener.php 1 location

@@ 48-53 (lines=6) @@
45
        $Mapping = $structure->getProperty($property->getName()) ?? MappingOperations::fromReflection($property);
46
        $Mapping = MappingOperations::toMutable($Mapping);
47
        $structure->setProperty($property->getName(), $Mapping);
48
        if (empty($annotation->views)) {
49
            $view = ViewOperations::toMutable($Mapping->getDefaultView());
50
            $view->setTargetEntity($className);
51
            $Mapping->setDefaultView($view);
52
            return;
53
        }
54
        foreach ($annotation->views as $name) {
55
            $view = ViewOperations::toMutable($Mapping->getView($name) ?? new View());
56
            $view->setTargetEntity($className);

src/Entity/Annotation/Listener/Mapping/Property/TypePropertyAnnotationListener.php 1 location

@@ 28-33 (lines=6) @@
25
        $mapping = $structure->getProperty($property->getName()) ?? MappingOperations::fromReflection($property);
26
        $mapping = MappingOperations::toMutable($mapping);
27
        $structure->setProperty($property->getName(), $mapping);
28
        if (empty($annotation->views)) {
29
            $view = ViewOperations::toMutable($mapping->getDefaultView());
30
            $view->setType($annotation->getValue());
31
            $mapping->setDefaultView($view);
32
            return;
33
        }
34
        foreach ($annotation->views as $name) {
35
            $view = ViewOperations::toMutable($mapping->getView($name) ?? new View());
36
            $view->setType($annotation->getValue());