Code Duplication    Length = 15-15 lines in 2 locations

app/Comment.php 1 location

@@ 35-49 (lines=15) @@
32
        return 'redirect: ' . Application::getUrl('/post/' . $comment->getPost()->getId());
33
    }
34
35
    private function fillUserInfomanionByLoginAccount($userContent, $parsedBody, LoginManagerInterface $loginManager, EntityManagerInterface $entityManager)
36
    {
37
        if ($loginManager->getLoggedAccountId()) {
38
            /** @var UserModel */
39
            $user = $entityManager->getRepository(UserModel::class)
40
                        ->findOneBy(['accountId' => $loginManager->getLoggedAccountId()]);
41
42
            $userContent->setUser($user);
43
            $userContent->setAuthor($user->getNickname());
44
            $userContent->setPassword($user->getPassword());
45
        } else {
46
            $userContent->setAuthor($parsedBody['author']);
47
            $userContent->setPassword($parsedBody['password']);
48
        }
49
    }
50
}
51

app/Post.php 1 location

@@ 80-94 (lines=15) @@
77
        return 'redirect: ' . Application::getUrl('/post/' . $this->post->getId());
78
    }
79
80
    private function fillUserInfomanionByLoginAccount($userContent, $parsedBody, LoginManagerInterface $loginManager)
81
    {
82
        if ($loginManager->getLoggedAccountId()) {
83
            /** @var UserModel */
84
            $user = $this->entityManager->getRepository(UserModel::class)
85
                        ->findOneBy(['accountId' => $loginManager->getLoggedAccountId()]);
86
87
            $userContent->setUser($user);
88
            $userContent->setAuthor($user->getNickname());
89
            $userContent->setPassword($user->getPassword());
90
        } else {
91
            $userContent->setAuthor($parsedBody['author']);
92
            $userContent->setPassword($parsedBody['password']);
93
        }
94
    }
95
}
96