Code Duplication    Length = 17-20 lines in 3 locations

Apps/Controller/Admin/Content.php 1 location

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

Apps/Controller/Admin/Profile.php 1 location

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

Apps/Controller/Admin/User.php 1 location

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