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

Apps/Controller/Admin/Feedback/ActionSettings.php (1 issue)

Labels
1
<?php
2
3
namespace Apps\Controller\Admin\Feedback;
4
5
use Apps\Model\Admin\Feedback\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\Feedback
14
 * @property Request $request
15
 * @property Response $response
16
 * @property View $view
17
 */
18
trait ActionSettings
19
{
20
    /**
21
     * @return string|null
22
     * @throws \Ffcms\Core\Exception\SyntaxException
23
     */
24
    public function settings(): ?string
25
    {
26
        // initialize model and pass configs
27
        $model = new FormSettings($this->getConfigs());
28
29
        // check if form is submited to save data
30
        if ($model->send()) {
31
            // is validation passed?
32
            if ($model->validate()) {
33
                // save properties
34
                $this->setConfigs($model->getAllProperties());
0 ignored issues
show
Are you sure the usage of $model->getAllProperties() targeting Ffcms\Core\Arch\Model::getAllProperties() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

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