MaintenanceController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 13
c 1
b 0
f 1
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A actions() 0 6 1
A behaviors() 0 9 1
1
<?php
2
3
namespace dominus77\maintenance\controllers\backend;
4
5
use yii\filters\AccessControl;
6
use yii\web\Controller;
7
use dominus77\maintenance\actions\backend\IndexAction;
8
9
/**
10
 * Class MaintenanceController
11
 * @package dominus77\maintenance\controllers\backend
12
 */
13
class MaintenanceController extends Controller
14
{
15
    /** @var string */
16
    public $viewPath;
17
18
    /**
19
     * Roles
20
     * @var array
21
     */
22
    public $roles = [];
23
24
    public function behaviors()
25
    {
26
        return [
27
            'access' => [
28
                'class' => AccessControl::class,
29
                'rules' => [
30
                    [
31
                        'allow' => true,
32
                        'roles' => $this->roles
33
                    ]
34
                ]
35
            ]
36
        ];
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    public function actions()
43
    {
44
        return [
45
            'index' => [
46
                'class' => IndexAction::class,
47
                'viewPath' => $this->viewPath
48
            ]
49
        ];
50
    }
51
}
52