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

PreviewController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A actionAccount() 0 15 2
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
}