MonitoringController::actionAccounts()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 15
rs 9.9
c 2
b 0
f 0
1
<?php
2
/**
3
 * Created for IG Monitoring.
4
 * User: jakim <[email protected]>
5
 * Date: 11.01.2018
6
 */
7
8
namespace app\commands;
9
10
11
use app\models\Account;
12
use app\models\Tag;
13
use yii\console\Controller;
14
use yii\console\widgets\Table;
15
16
class MonitoringController extends Controller
17
{
18
    public function actionIndex()
19
    {
20
        $this->actionAccounts();
21
        $this->actionTags();
22
    }
23
24
    public function actionAccounts()
25
    {
26
        echo Table::widget([
27
            'headers' => [
28
                'ID',
29
                'Username',
30
            ],
31
            'rows' => Account::find()
32
                ->select([
33
                    'id',
34
                    'username',
35
                ])
36
                ->monitoring()
37
                ->asArray()
38
                ->all(),
39
        ]);
40
    }
41
42
    public function actionTags()
43
    {
44
        echo Table::widget([
45
            'headers' => [
46
                'ID',
47
                'Tag',
48
            ],
49
            'rows' => Tag::find()
50
                ->select([
51
                    'id',
52
                    'name',
53
                ])
54
                ->monitoring()
55
                ->asArray()
56
                ->all(),
57
        ]);
58
    }
59
}