Module   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 73
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDb() 0 4 1
A panelsList() 0 13 3
1
<?php
2
3
namespace cornernote\dashboard;
4
5
use Yii;
6
use yii\db\Connection;
7
8
/**
9
 * Dashboard Module
10
 * @package cornernote\dashboard
11
 */
12
class Module extends \yii\base\Module
13
{
14
15
    /**
16
     * @inheritdoc
17
     */
18
    public $layout = 'main';
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public $defaultRoute = 'dashboard';
24
25
    /**
26
     * @inheritdoc
27
     */
28
    public $controllerNamespace = 'cornernote\dashboard\controllers';
29
30
    /**
31
     * @var string name of the component to use for database access
32
     */
33
    public $db = 'db';
34
35
    /**
36
     * @var array
37
     */
38
    public $layouts = [
39
        'default' => 'cornernote\dashboard\layouts\DefaultLayout',
40
    ];
41
42
43
    public $viewPath;
44
45
	/**
46
	 * @var array
47
	 */
48
	public $dashboards = [];
49
50
	/**
51
	 * @var array
52
	 */
53
    public $panels = [
54
        'text' => 'cornernote\dashboard\panels\TextPanel',
55
    ];
56
57
	/**
58
	 * @var array
59
	 */
60
	public $updateRoles;
61
62
	/**
63
     * @return Connection the database connection.
64
     */
65
    public function getDb()
66
    {
67
        return Yii::$app->{$this->db};
68
    }
69
70
	public function panelsList()
71
	{
72
		$list = [];
73
		foreach ($this->panels as $name => $config) {
74
			if (is_array($config)) {
75
				$list[$config['class']] = $name;
76
				continue;
77
			}
78
			$list[$config] = $name;
79
		}
80
81
		return $list;
82
	}
83
84
}
85