Passed
Push — master ( 521cc3...0e2339 )
by Paweł
03:32
created

MonitoringController::actionAccounts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 17
rs 9.8333
c 0
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\Proxy;
13
use app\models\Tag;
14
use yii\console\Controller;
15
use yii\console\ExitCode;
16
use yii\console\widgets\Table;
17
use yii\helpers\Console;
18
use yii\helpers\Inflector;
19
20
class MonitoringController extends Controller
21
{
22
    public function actionIndex()
23
    {
24
        $this->actionAccounts();
25
        $this->actionTags();
26
    }
27
28
    public function actionAccounts()
29
    {
30
        echo Table::widget([
31
            'headers' => [
32
                'ID',
33
                'Username',
34
                'Proxy ID',
35
            ],
36
            'rows' => Account::find()
37
                ->select([
38
                    'id',
39
                    'username',
40
                    'proxy_id',
41
                ])
42
                ->monitoring()
43
                ->asArray()
44
                ->all(),
45
        ]);
46
    }
47
48
    public function actionTags()
49
    {
50
        echo Table::widget([
51
            'headers' => [
52
                'ID',
53
                'Tag',
54
                'Proxy ID',
55
            ],
56
            'rows' => Tag::find()
57
                ->select([
58
                    'id',
59
                    'name',
60
                    'proxy_id',
61
                ])
62
                ->monitoring()
63
                ->asArray()
64
                ->all(),
65
        ]);
66
    }
67
}