Passed
Push — master ( 255824...e1611d )
by Paweł
02:48
created

PreviewController::actionAccount()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 15
rs 9.4285
1
<?php
2
/**
3
 * Created for IG Monitoring.
4
 * User: jakim <[email protected]>
5
 * Date: 20.04.2018
6
 */
7
8
namespace app\controllers;
9
10
11
use app\models\Account;
12
use app\modules\admin\components\AccountStatsManager;
13
use yii\web\Controller;
14
use yii\web\NotFoundHttpException;
15
16
class PreviewController extends Controller
17
{
18
    public function actionAccount($uid)
19
    {
20
        $account = Account::findOne(['uid' => $uid, 'monitoring' => 1]);
21
        if ($account === null) {
22
            throw new NotFoundHttpException();
23
        }
24
25
        $manager = \Yii::createObject([
26
            'class' => AccountStatsManager::class,
27
            'account' => $account,
28
        ]);
29
30
        return $this->render('account', [
31
            'model' => $account,
32
            'manager' => $manager,
33
34
        ]);
35
    }
36
37
}