Code Duplication    Length = 20-24 lines in 2 locations

Apps/Controller/Admin/User.php 2 locations

@@ 63-86 (lines=24) @@
60
     * @return string
61
     * @throws \Ffcms\Core\Exception\SyntaxException
62
     */
63
    public function actionUpdate($id)
64
    {
65
        $user = UserRecords::findOrNew($id);
66
67
        // find user identify object
68
        //$user = App::$User->identity($id);
69
        // generate model data based on user object
70
        $model = new FormUserUpdate($user);
71
72
        // check is form is sended
73
        if ($model->send()) {
74
            if ($model->validate()) { // check validation
75
                $model->save();
76
                App::$Session->getFlashBag()->add('success', __('Data was successful updated'));
77
            } else {
78
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
79
            }
80
        }
81
82
        // render viewer
83
        return App::$View->render('user_update', [
84
            'model' => $model->export()
85
        ]);
86
    }
87
88
    /**
89
     * Delete user row from database
@@ 137-156 (lines=20) @@
134
     * @param int $id
135
     * @return string
136
     */
137
    public function actionGroupUpdate($id)
138
    {
139
        // find role or create new object
140
        $role = Role::findOrNew($id);
141
142
        $model = new FormUserGroupUpdate($role);
143
        if ($model->send()) { // work with post request
144
            if ($model->validate()) {
145
                $model->save();
146
                App::$Session->getFlashBag()->add('success', __('Data was successful updated'));
147
            } else {
148
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
149
            }
150
        }
151
152
        // render view
153
        return App::$View->render('group_update', [
154
            'model' => $model
155
        ]);
156
    }
157
158
    /**
159
     * User identity settings