Code Duplication    Length = 8-9 lines in 2 locations

src/Repository/UserRepository.php 2 locations

@@ 20-28 (lines=9) @@
17
     * @return UserInterface
18
     * @throws \Exception
19
     */
20
    public function save(UserInterface $user)
21
    {
22
        if(!$user->getID()) {
23
            $this->_em->persist($user);
24
        }
25
        $this->_em->flush($user);
26
        $this->_em->flush($user->getPerson());
27
        return $user;
28
    }
29
30
    /**
31
     * @param UserInterface $user
@@ 35-42 (lines=8) @@
32
     * @param bool $deletePerson
33
     * @throws \Exception
34
     */
35
    public function delete(UserInterface $user, $deletePerson = false)
36
    {
37
        if($deletePerson) {
38
            $this->_em->remove($user->getPerson());
39
        }
40
        $this->_em->remove($user);
41
        $this->_em->flush($user);
42
    }
43
44
    /**
45
     * @param UserCriteria $criteria