MaintenanceController::behaviors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
c 1
b 0
f 1
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
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