Passed
Push — master ( fcf8a0...ba2801 )
by Mihail
04:49
created

Newcontent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 6
dl 0
loc 27
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A actionIndex() 0 16 3
1
<?php
2
3
namespace Apps\Controller\Admin;
4
5
use Ffcms\Core\App;
6
use Extend\Core\Arch\AdminController;
7
use Apps\Model\Admin\Newcontent\FormSettings;
8
9
/**
10
 * Admin controller of new content widget.
11
 */
12
class Newcontent extends AdminController
13
{
14
    const VERSION = 0.1;
15
    
16
    public $type = 'widget';
17
18
    /**
19
     * Show widget settings
20
     * @return string
21
     */
22
    public function actionIndex()
23
    {
24
        // init settings model
25
        $model = new FormSettings($this->getConfigs());
26
        
27
        // check if request is submited
28
        if ($model->send() && $model->validate()) {
29
            $this->setConfigs($model->getResult());
30
            App::$Session->getFlashBag()->add('success', __('Settings is successful updated'));
31
        }
32
        
33
        // render viewer
34
        return App::$View->render('index', [
35
            'model' => $model->export()
36
        ]);
37
    }
38
}