Code Duplication    Length = 6-6 lines in 2 locations

src/Entity/Annotation/Listener/Mapping/Clazz/StructureParameterAnnotationListener.php 1 location

@@ 26-31 (lines=6) @@
23
        $mapping = MappingOperations::toMutable($descriptor->getMapping());
24
        $descriptor->setMapping($mapping);
25
        $views = $annotation instanceof ViewAwareAnnotationInterface ? $annotation->getViews() : null;
26
        if (empty($views)) {
27
            $view = ViewOperations::toMutable($mapping->getDefaultView());
28
            $view->setParameter($annotation->getParameter(), $annotation->getValue());
29
            $mapping->setDefaultView($view);
30
            return;
31
        }
32
        foreach ($views as $name) {
33
            $view = ViewOperations::toMutable($mapping->getView($name) ?? new View());
34
            $view->setParameter($annotation->getParameter(), $annotation->getValue());

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

@@ 30-35 (lines=6) @@
27
        $mapping = MappingOperations::toMutable($mapping);
28
        $structure->setProperty($property->getName(), $mapping);
29
        $views = $annotation instanceof ViewAwareAnnotationInterface ? $annotation->getViews() : null;
30
        if (empty($views)) {
31
            $view = ViewOperations::toMutable($mapping->getDefaultView());
32
            $view->setParameter($annotation->getParameter(), $annotation->getValue());
33
            $mapping->setDefaultView($view);
34
            return;
35
        }
36
        foreach ($views as $name) {
37
            $view = ViewOperations::toMutable($mapping->getView($name) ?? new View());
38
            $view->setParameter($annotation->getParameter(), $annotation->getValue());