Conditions | 4 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 22 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
25 | View Code Duplication | public function settings() |
|
|
|||
26 | { |
||
27 | // init settings model and process post send |
||
28 | $model = new FormSettings(true); |
||
29 | if ($model->send()) { |
||
30 | if ($model->validate()) { |
||
31 | if ($model->makeSave()) { |
||
32 | // show message about successful save and take system some time ;) |
||
33 | return $this->view->render('settings_save'); |
||
34 | } else { |
||
35 | App::$Session->getFlashBag()->add('error', __('Configuration file is not writable! Check /Private/Config/ dir and files')); |
||
36 | } |
||
37 | } else { |
||
38 | App::$Session->getFlashBag()->add('error', __('Validation of form data is failed!')); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | // render output view |
||
43 | return $this->view->render('settings', [ |
||
44 | 'model' => $model |
||
45 | ]); |
||
46 | } |
||
47 | } |
||
48 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.