RoleController   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A actionUpdate() 0 7 2
A actionView() 0 7 2
A actionDelete() 0 7 2
A actionIndex() 0 7 2
A actionCreate() 0 7 2
1
<?php
2
3
namespace app\controllers\admin;
4
5
use app\traits\{AdminBeforeActionTrait, AccessTrait};
6
use Itstructure\RbacModule\controllers\RoleController as BaseRoleController;
7
8
/**
9
 * Class RoleController
10
 * RoleController implements the CRUD actions for Role model.
11
 *
12
 * @package app\controllers\admin
13
 *
14
 * @author Andrey Girnik <[email protected]>
15
 */
16
class RoleController extends BaseRoleController
17
{
18
    use AdminBeforeActionTrait, AccessTrait;
0 ignored issues
show
Bug introduced by
The trait app\traits\AdminBeforeActionTrait requires the property $controller which is not provided by app\controllers\admin\RoleController.
Loading history...
Bug introduced by
The trait app\traits\AccessTrait requires the property $user which is not provided by app\controllers\admin\RoleController.
Loading history...
19
20
    /**
21
     * @return mixed|string
22
     */
23
    public function actionIndex()
24
    {
25
        if (!$this->checkAccessToIndex()) {
26
            return $this->accessError();
27
        }
28
29
        return parent::actionIndex();
30
    }
31
32
    /**
33
     * @param int|string $id
34
     *
35
     * @return mixed
36
     */
37
    public function actionView($id)
38
    {
39
        if (!$this->checkAccessToView()) {
40
            return $this->accessError();
41
        }
42
43
        return parent::actionView($id);
44
    }
45
46
    /**
47
     * @return mixed|string|\yii\web\Response
48
     */
49
    public function actionCreate()
50
    {
51
        if (!$this->checkAccessToCreate()) {
52
            return $this->accessError();
53
        }
54
55
        return parent::actionCreate();
56
    }
57
58
    /**
59
     * @param int|string $id
60
     *
61
     * @return string|\yii\web\Response
62
     */
63
    public function actionUpdate($id)
64
    {
65
        if (!$this->checkAccessToUpdate()) {
66
            return $this->accessError();
67
        }
68
69
        return parent::actionUpdate($id);
70
    }
71
72
    /**
73
     * @param int|string $id
74
     *
75
     * @return mixed|\yii\web\Response
76
     */
77
    public function actionDelete($id)
78
    {
79
        if (!$this->checkAccessToDelete()) {
80
            return $this->accessError();
81
        }
82
83
        return parent::actionDelete($id);
84
    }
85
}
86