MainMenu   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 26
ccs 0
cts 22
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A items() 0 23 2
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