MainMenu::items()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 23
ccs 0
cts 22
cp 0
rs 9.552
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
/**
3
 * HiSite Yii2 base project.
4
 *
5
 * @link      https://github.com/hiqdev/hisite
6
 * @package   hisite
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hisite\menus;
12
13
use Yii;
14
15
class MainMenu extends \hiqdev\yii2\menus\Menu
16
{
17
    public function items()
18
    {
19
        $logOp = Yii::$app->user->isGuest ? 'login' : 'logout';
20
21
        return [
22
            'home' => [
23
                'label' => Yii::t('hisite', 'Home'),
24
                'url' => ['/site/index'],
25
            ],
26
            'about' => [
27
                'label' => Yii::t('hisite', 'About'),
28
                'url' => ['/site/about'],
29
            ],
30
            'contact' => [
31
                'label' => Yii::t('hisite', 'Contact'),
32
                'url' => ['/site/contact'],
33
            ],
34
            $logOp => [
35
                'label' => Yii::t('hisite', ucfirst($logOp)),
36
                'url' => ['/site/' . $logOp],
37
            ],
38
        ];
39
    }
40
}
41