AboutController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 40
c 0
b 0
f 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A actionIndex() 0 8 1
A behaviors() 0 17 1
1
<?php
2
3
namespace app\controllers;
4
5
use app\models\About;
6
use yii\filters\{AccessControl, VerbFilter};
7
use yii\helpers\ArrayHelper;
8
9
/**
10
 * Class AboutController
11
 *
12
 * @package app\controllers
13
 */
14
class AboutController extends BaseController
15
{
16
    /**
17
     * @return array
18
     */
19
    public function behaviors()
20
    {
21
        return ArrayHelper::merge(parent::behaviors(), [
22
            'access' => [
23
                'class' => AccessControl::class,
24
                'rules' => [
25
                    [
26
                        'allow' => true,
27
                        'actions' => ['index'],
28
                        'roles' => ['?', '@'],
29
                    ],
30
                ],
31
            ],
32
            'verbs' => [
33
                'class' => VerbFilter::class,
34
                'actions' => [
35
                    'index' => ['get'],
36
                ],
37
            ],
38
        ]);
39
    }
40
41
    /**
42
     * Displays about page.
43
     *
44
     * @return string
45
     */
46
    public function actionIndex()
47
    {
48
        $model = About::getDefaultAbout();
49
50
        $this->setMetaParams($model);
0 ignored issues
show
Bug introduced by
It seems like $model can also be of type array; however, parameter $model of app\controllers\BaseController::setMetaParams() does only seem to accept null|yii\db\ActiveRecord, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

50
        $this->setMetaParams(/** @scrutinizer ignore-type */ $model);
Loading history...
51
52
        return $this->render('index', [
53
            'model' => $model
54
        ]);
55
    }
56
}
57