Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/Controller/Admin/Comments/ActionSettings.php (2 issues)

Labels
1
<?php
2
3
namespace Apps\Controller\Admin\Comments;
4
5
use Apps\Model\Admin\Comments\FormSettings;
6
use Ffcms\Core\App;
7
use Ffcms\Core\Arch\View;
8
use Ffcms\Core\Network\Request;
9
use Ffcms\Core\Network\Response;
10
11
/**
12
 * Trait ActionSettings
13
 * @package Apps\Controller\Admin\Comments
14
 * @property Request $request
15
 * @property Response $response
16
 * @property View $view
17
 */
18
trait ActionSettings
19
{
20
    /**
21
     * Comment widget global settings
22
     * @return string
23
     * @throws \Ffcms\Core\Exception\SyntaxException
24
     */
25
    public function settings()
26
    {
27
        // initialize settings model
28
        $model = new FormSettings($this->getConfigs());
0 ignored issues
show
It seems like getConfigs() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        $model = new FormSettings($this->/** @scrutinizer ignore-call */ getConfigs());
Loading history...
29
30
        // check if form is send
31
        if ($model->send()) {
32
            if ($model->validate()) {
33
                $this->setConfigs($model->getAllProperties());
0 ignored issues
show
It seems like setConfigs() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
                $this->/** @scrutinizer ignore-call */ 
34
                       setConfigs($model->getAllProperties());
Loading history...
34
                App::$Session->getFlashBag()->add('success', __('Settings is successful updated'));
35
                $this->response->redirect('comments/index');
36
            } else {
37
                App::$Session->getFlashBag()->add('error', __('Form validation is failed'));
38
            }
39
        }
40
41
        // render view
42
        return $this->view->render('comments/settings', [
43
            'model' => $model
44
        ]);
45
    }
46
}
47