Code Duplication    Length = 4-4 lines in 2 locations

src/Kunstmaan/PagePartBundle/Helper/Services/PagePartCreatorService.php 1 location

@@ 98-101 (lines=4) @@
95
        $page = $translation->getRef($this->em);
96
97
        // Find latest position.
98
        if (\is_null($position)) {
99
            $pageParts = $this->pagePartRepo->getPagePartRefs($page, $context);
100
            $position = \count($pageParts) + 1;
101
        }
102
103
        $this->em->persist($pagePart);
104
        $this->em->flush();

src/Kunstmaan/FixturesBundle/Builder/PagePartBuilder.php 1 location

@@ 84-87 (lines=4) @@
81
            // Find latest position.
82
            $position = array_key_exists('position', $params) ? $params['position'] : null;
83
            $context = isset($params['context']) ? $params['context'] : 'main';
84
            if (is_null($position)) {
85
                $pageParts = $this->pagePartRepo->getPagePartRefs($page, $context);
86
                $position = count($pageParts) + 1;
87
            }
88
89
            $this->pagePartRepo->addPagePart($page, $pp, $position, $context);
90
            $first = false;