Conditions | 3 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 16 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function actionIndex() |
||
20 | { |
||
21 | // initialize model and pass configs as arg |
||
22 | $model = new FormSettings($this->getConfigs()); |
||
23 | |||
24 | // check if form of depend model is submited |
||
25 | if ($model->send() && $model->validate()) { |
||
26 | $this->setConfigs($model->getAllProperties()); |
||
27 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
||
28 | } |
||
29 | |||
30 | // render view output |
||
31 | return App::$View->render('index', [ |
||
32 | 'model' => $model |
||
33 | ]); |
||
34 | } |
||
35 | } |
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.