FrontendController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
c 0
b 0
f 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A actions() 0 5 1
A beforeAction() 0 6 2
1
<?php
2
3
namespace frontend\controllers;
4
5
use yii\base\Action;
6
use yii\web\BadRequestHttpException;
7
use yii\web\Controller;
8
use yii\web\ErrorAction;
9
10
/**
11
 * Class FrontendController
12
 * @package frontend\controllers
13
 */
14
class FrontendController extends Controller
15
{
16
    /**
17
     * @return array
18
     */
19
    public function actions()
20
    {
21
        return [
22
            'error' => [
23
                'class' => ErrorAction::class
24
            ],
25
        ];
26
    }
27
28
    /**
29
     * @param Action $action
30
     * @return bool
31
     * @throws BadRequestHttpException
32
     */
33
    public function beforeAction($action)
34
    {
35
        if ($action->id === 'error') {
36
            $this->layout = 'main.php';
37
        }
38
        return parent::beforeAction($action);
39
    }
40
}
41