Code Duplication    Length = 20-24 lines in 2 locations

Apps/Controller/Admin/User.php 2 locations

@@ 71-94 (lines=24) @@
68
     * @throws \Ffcms\Core\Exception\NativeException
69
     * @throws \Ffcms\Core\Exception\SyntaxException
70
     */
71
    public function actionUpdate($id)
72
    {
73
        $user = UserRecords::findOrNew($id);
74
75
        // find user identify object
76
        //$user = App::$User->identity($id);
77
        // generate model data based on user object
78
        $model = new FormUserUpdate($user);
79
80
        // check is form is sended
81
        if ($model->send()) {
82
            if ($model->validate()) { // check validation
83
                $model->save();
84
                App::$Session->getFlashBag()->add('success', __('Data was successful updated'));
85
            } else {
86
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
87
            }
88
        }
89
90
        // render viewer
91
        return App::$View->render('user_update', [
92
            'model' => $model->filter()
93
        ]);
94
    }
95
96
    /**
97
     * Delete user row from database
@@ 160-179 (lines=20) @@
157
     * @throws \Ffcms\Core\Exception\SyntaxException
158
     * @throws \Ffcms\Core\Exception\NativeException
159
     */
160
    public function actionGroupUpdate($id)
161
    {
162
        // find role or create new object
163
        $role = Role::findOrNew($id);
164
165
        $model = new FormUserGroupUpdate($role);
166
        if ($model->send()) { // work with post request
167
            if ($model->validate()) {
168
                $model->save();
169
                App::$Session->getFlashBag()->add('success', __('Data was successful updated'));
170
            } else {
171
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
172
            }
173
        }
174
175
        // render view
176
        return App::$View->render('group_update', [
177
            'model' => $model->filter()
178
        ]);
179
    }
180
181
    /**
182
     * User identity settings