Code Duplication    Length = 18-21 lines in 4 locations

Apps/Controller/Admin/Comments.php 1 location

@@ 29-49 (lines=21) @@
26
        ]);
27
    }
28
29
    public function actionSettings()
30
    {
31
        // initialize settings model
32
        $model = new FormSettings($this->getConfigs());
33
34
        // check if form is send
35
        if ($model->send()) {
36
            if ($model->validate()) {
37
                $this->setConfigs($model->getAllProperties());
38
                App::$Session->getFlashBag()->add('success', __('Settings is successful updated'));
39
                App::$Response->redirect('comments/index');
40
            } else {
41
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
42
            }
43
        }
44
45
        // render view
46
        return App::$View->render('settings', [
47
            'model' => $model
48
        ]);
49
    }
50
51
52

Apps/Controller/Admin/Content.php 1 location

@@ 336-356 (lines=21) @@
333
     * @return string
334
     * @throws SyntaxException
335
     */
336
    public function actionSettings()
337
    {
338
        // init model with config array data
339
        $model = new FormSettings($this->getConfigs());
340
341
        // check if form is send
342
        if ($model->send()) {
343
            if ($model->validate()) {
344
                $this->setConfigs($model->getAllProperties());
345
                App::$Session->getFlashBag()->add('success', __('Settings is successful updated'));
346
                App::$Response->redirect('content/index');
347
            } else {
348
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
349
            }
350
        }
351
352
        // draw response
353
        return App::$View->render('settings', [
354
            'model' => $model->export()
355
        ]);
356
    }
357
}

Apps/Controller/Admin/Profile.php 1 location

@@ 183-200 (lines=18) @@
180
     * @return string
181
     * @throws \Ffcms\Core\Exception\SyntaxException
182
     */
183
    public function actionSettings()
184
    {
185
        $model = new FormSettings($this->getConfigs());
186
187
        if ($model->send()) {
188
            if ($model->validate()) {
189
                $this->setConfigs($model->getAllProperties());
190
                App::$Session->getFlashBag()->add('success', __('Settings is successful updated'));
191
                App::$Response->redirect('profile/index');
192
            } else {
193
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
194
            }
195
        }
196
197
        return App::$View->render('settings', [
198
            'model' => $model
199
        ]);
200
    }
201
202
203
}

Apps/Controller/Admin/User.php 1 location

@@ 162-181 (lines=20) @@
159
     * User identity settings
160
     * @return string
161
     */
162
    public function actionSettings()
163
    {
164
        // load model and pass property's as argument
165
        $model = new FormUserSettings($this->getConfigs());
166
167
        if ($model->send()) {
168
            if ($model->validate()) {
169
                $this->setConfigs($model->getAllProperties());
170
                App::$Session->getFlashBag()->add('success', __('Settings is successful updated'));
171
                App::$Response->redirect('user/index');
172
            } else {
173
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
174
            }
175
        }
176
177
        // render view
178
        return App::$View->render('settings', [
179
            'model' => $model->export()
180
        ]);
181
    }
182
183
    /**
184
     * Send invite to user by email