1 | <?php |
||||||
2 | |||||||
3 | namespace Apps\Controller\Admin\Content; |
||||||
4 | |||||||
5 | use Apps\Model\Admin\Content\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\Content |
||||||
14 | * @property Request $request |
||||||
15 | * @property Response $response |
||||||
16 | * @property View $view |
||||||
17 | */ |
||||||
18 | trait ActionSettings |
||||||
19 | { |
||||||
20 | /** |
||||||
21 | * Show graphical settings configurator interface |
||||||
22 | * @return null|string |
||||||
23 | * @throws \Ffcms\Core\Exception\SyntaxException |
||||||
24 | */ |
||||||
25 | public function settings(): ?string |
||||||
26 | { |
||||||
27 | // init model with config array data |
||||||
28 | $model = new FormSettings($this->getConfigs()); |
||||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
29 | |||||||
30 | // check if form is submited |
||||||
31 | if ($model->send()) { |
||||||
32 | if ($model->validate()) { |
||||||
33 | $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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
Loading history...
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
Loading history...
|
|||||||
34 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
||||||
35 | $this->response->redirect('content/index'); |
||||||
36 | } else { |
||||||
37 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
||||||
38 | } |
||||||
39 | } |
||||||
40 | |||||||
41 | // render response |
||||||
42 | return $this->view->render('content/settings', [ |
||||||
43 | 'model' => $model |
||||||
44 | ]); |
||||||
45 | } |
||||||
46 | } |
||||||
47 |