Code Duplication    Length = 16-18 lines in 2 locations

src/AppBundle/Controller/UserController.php 2 locations

@@ 68-83 (lines=16) @@
65
     * @param  User $user
66
     * @return RedirectResponse
67
     */
68
    public function activationAction(Request $request, User $user)
69
    {
70
        $em = $this->getDoctrine()->getManager();
71
        $form = $this->createForm(ActivationType::class, $user, [
72
            'method' => "PUT",
73
            'action' => $this->generateUrl('activate_user', array('id' => $user->getId())),
74
            'validation_groups' => array('edit'),
75
        ]);
76
        $form->handleRequest($request);
77
        if ($form->isValid()) {
78
            $em->persist($user);
79
            $em->flush();
80
        }
81
82
        return $this->redirect($this->generateUrl("users_list"));
83
    }
84
85
    /**
86
     * @Route("/user/add", name="add_user")
@@ 120-137 (lines=18) @@
117
     * @param User $user
118
     * @return array|RedirectResponse
119
     */
120
    public function editAction(Request $request, User $user)
121
    {
122
        $em = $this->getDoctrine()->getManager();
123
        $form = $this->createForm(EditType::class, $user, [
124
            'action' => $this->generateUrl('edit_user', array('id' => $user->getId())),
125
            'method' => 'POST',
126
            'validation_groups' => array('edit'),
127
        ]);
128
        $form->handleRequest($request);
129
        if ($form->isValid()) {
130
            $em->persist($user);
131
            $em->flush();
132
133
            return $this->redirect($this->generateUrl("users_list"));
134
        }
135
136
        return ['form' => $form->createView()];
137
    }
138
}
139