ErrorController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A actionIndex() 0 10 1
A actionView() 0 10 2
1
<?php
2
3
namespace bedezign\yii2\audit\controllers;
4
5
use bedezign\yii2\audit\components\web\Controller;
6
use bedezign\yii2\audit\models\AuditError;
7
use bedezign\yii2\audit\models\AuditErrorSearch;
8
use Yii;
9
use yii\web\NotFoundHttpException;
10
11
/**
12
 * ErrorController
13
 * @package bedezign\yii2\audit\controllers
14
 */
15
class ErrorController extends Controller
16
{
17
    /**
18
     * Lists all AuditError models.
19
     * @return mixed
20
     */
21 6
    public function actionIndex()
22
    {
23 6
        $searchModel = new AuditErrorSearch;
24 6
        $dataProvider = $searchModel->search(Yii::$app->request->get());
25
26 6
        return $this->render('index', [
27 6
            'dataProvider' => $dataProvider,
28 6
            'searchModel'  => $searchModel,
29 6
        ]);
30
    }
31
32
    /**
33
     * Displays a single AuditError model.
34
     * @param integer $id
35
     * @return mixed
36
     * @throws NotFoundHttpException
37
     */
38 6
    public function actionView($id)
39
    {
40 6
        $model = AuditError::findOne($id);
41 6
        if (!$model) {
42 3
            throw new NotFoundHttpException('The requested error does not exist.');
43
        }
44 3
        return $this->render('view', [
45 3
            'model' => $model,
46 3
        ]);
47
    }
48
}
49