Code Duplication    Length = 17-20 lines in 3 locations

Apps/Controller/Admin/Content.php 1 location

@@ 283-302 (lines=20) @@
280
    /**
281
     * Content app settings
282
     */
283
    public function actionSettings()
284
    {
285
        // init model with config array data
286
        $model = new FormSettings($this->getConfigs());
287
288
        // check if form is send
289
        if ($model->send()) {
290
            if ($model->validate()) {
291
                $this->setConfigs($model->getAllProperties());
292
                App::$Response->redirect('content/index');
293
            } else {
294
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
295
            }
296
        }
297
298
        // draw response
299
        $this->response = App::$View->render('settings', [
300
            'model' => $model->export()
301
        ]);
302
    }
303
}

Apps/Controller/Admin/Profile.php 1 location

@@ 163-179 (lines=17) @@
160
        ]);
161
    }
162
163
    public function actionSettings()
164
    {
165
        $model = new FormSettings($this->getConfigs());
166
167
        if ($model->send()) {
168
            if ($model->validate()) {
169
                $this->setConfigs($model->getAllProperties());
170
                App::$Response->redirect('profile/index');
171
            } else {
172
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
173
            }
174
        }
175
176
        $this->response = App::$View->render('settings', [
177
            'model' => $model
178
        ]);
179
    }
180
181
182
}

Apps/Controller/Admin/User.php 1 location

@@ 145-163 (lines=19) @@
142
    /**
143
     * User identity settings
144
     */
145
    public function actionSettings()
146
    {
147
        // load model and pass property's as argument
148
        $model = new FormUserSettings($this->getConfigs());
149
150
        if ($model->send()) {
151
            if ($model->validate()) {
152
                $this->setConfigs($model->getAllProperties());
153
                App::$Response->redirect('user/index');
154
            } else {
155
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
156
            }
157
        }
158
159
        // render view
160
        $this->response = App::$View->render('settings', [
161
            'model' => $model->export()
162
        ]);
163
    }
164
165
    /**
166
     * Send invite to users