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

Newcontent::actionIndex()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 14
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 14
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 0
1
<?php
2
3
namespace Apps\Controller\Admin;
4
5
use Apps\Model\Admin\Newcontent\FormSettings;
6
use Extend\Core\Arch\AdminController;
7
use Ffcms\Core\App;
8
9
/**
10
 * Class Newcontent. Admin controller of new content widget.
11
 * @package Apps\Controller\Admin
12
 */
13
class Newcontent extends AdminController
14
{
15
    const VERSION = '1.0.1';
16
17
    public $type = 'widget';
18
19
    /**
20
     * Show widget settings
21
     * @return string
22
     * @throws \Ffcms\Core\Exception\SyntaxException
23
     */
24
    public function actionIndex(): ?string
25
    {
26
        // init settings model
27
        $model = new FormSettings($this->getConfigs());
28
29
        // check if request is submited
30
        if ($model->send() && $model->validate()) {
31
            $this->setConfigs($model->getAllProperties());
0 ignored issues
show
Bug introduced by zenn
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...
32
            App::$Session->getFlashBag()->add('success', __('Settings is successful updated'));
33
        }
34
35
        // render viewer
36
        return $this->view->render('newcontent/index', [
37
            'model' => $model
38
        ]);
39
    }
40
}
41