Passed
Push — master ( 8a98a7...504233 )
by Kyle
13:16
created

MetronicHorizontalMenuPresenter   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 21
dl 0
loc 99
ccs 0
cts 26
cp 0
rs 10
c 2
b 0
f 0
wmc 9

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getDividerWrapper() 0 3 1
A getActiveState() 0 3 2
A getCloseTagWrapper() 0 3 1
A getOpenTagWrapper() 0 3 1
A getMenuWithDropDownWrapper() 0 33 2
A getMultiLevelDropdownWrapper() 0 18 1
A getMenuWithoutDropdownWrapper() 0 3 1
1
<?php
2
3
/*
4
 * Horizontal Menu for Metronic by KeenThemes (https://keenthemes.com/metronic/)
5
 * Author: Christian David ([email protected])
6
 * Description: Generate horizontal menu to metronic theme
7
 */
8
9
namespace App\Presenters;
10
11
use KyleMassacre\Menus\Presenters\Presenter;
12
13
class MetronicHorizontalMenuPresenter extends Presenter
14
{
15
    /**
16
     * {@inheritdoc }
17
     */
18
    public function getOpenTagWrapper()
19
    {
20
        return PHP_EOL . '<ul class="m-menu__nav  m-menu__nav--submenu-arrow ">' . PHP_EOL;
21
    }
22
23
    /**
24
     * {@inheritdoc }
25
     */
26
    public function getCloseTagWrapper()
27
    {
28
        return PHP_EOL . '</ul>' . PHP_EOL;
29
    }
30
31
    /**
32
     * {@inheritdoc }
33
     */
34
    public function getMenuWithoutDropdownWrapper($item)
35
    {
36
        return '<li ' . $this->getActiveState($item) . '>' . $item->getIcon() . '<a href="' . $item->getUrl() . '" class="m-menu__link"><span class="m-menu__item-here"></span><span class="m-menu__link-text">' . $item->title . '</span></a></li>';
37
    }
38
39
    /**
40
     * {@inheritdoc }
41
     */
42
    public function getActiveState($item)
43
    {
44
        return \Request::is($item->getRequest()) ? ' class="m-menu__item  m-menu__item--rel active"' : 'class="m-menu__item  m-menu__item--rel"';
45
    }
46
47
    /**
48
     * {@inheritdoc }
49
     */
50
    public function getDividerWrapper()
51
    {
52
        return '';
53
    }
54
55
    /**
56
     * {@inheritdoc }
57
     */
58
    public function getMenuWithDropDownWrapper($item)
59
    {
60
        if ($item->title == '...') {
61
            return '<li class="m-menu__item  m-menu__item--submenu m-menu__item--rel"  data-menu-submenu-toggle="click" aria-haspopup="true">
62
                            <a  href="#" class="m-menu__link m-menu__toggle">
63
                                <span class="m-menu__item-here"></span>
64
                                <i class="m-menu__link-icon flaticon-more-v3"></i>
65
                                <span class="m-menu__link-text"></span>
66
                            </a>
67
                            <div class="m-menu__submenu m-menu__submenu--classic m-menu__submenu--left m-menu__submenu--pull">
68
                                <span class="m-menu__arrow m-menu__arrow--adjust"></span>
69
                                <ul class="m-menu__subnav">
70
                                    ' . $this->getChildMenuItems($item) . '
71
                                </ul>
72
                            </div>
73
                        </li>' . PHP_EOL;
74
        } else {
75
            return '<li class="m-menu__item  m-menu__item--submenu m-menu__item--rel"  data-menu-submenu-toggle="click" aria-haspopup="true">
76
                            <a  href="#" class="m-menu__link m-menu__toggle">
77
                                ' . $item->getIcon() . '
78
                                <span class="m-menu__link-text">
79
                                    ' . $item->title . '
80
                                </span>
81
                                <i class="m-menu__hor-arrow la la-angle-down"></i>
82
                                <i class="m-menu__ver-arrow la la-angle-right"></i>
83
                            </a>
84
                            <div class="m-menu__submenu m-menu__submenu--classic m-menu__submenu--left">
85
                                <span class="m-menu__arrow m-menu__arrow--adjust"></span>
86
                                <ul class="m-menu__subnav">
87
                                    ' . $this->getChildMenuItems($item) . '
88
                                </ul>
89
                            </div>
90
                        </li>' . PHP_EOL;
91
        }
92
    }
93
94
    public function getMultiLevelDropdownWrapper($item)
95
    {
96
        return '<li class="m-menu__item  m-menu__item--submenu"  data-menu-submenu-toggle="hover" data-redirect="true" aria-haspopup="true">
97
                            <a  href="#" class="m-menu__link m-menu__toggle">
98
                                ' . $item->getIcon() . '
99
                                <span class="m-menu__link-text">
100
                                    ' . $item->title . '
101
                                </span>
102
                                <i class="m-menu__hor-arrow la la-angle-right"></i>
103
                                <i class="m-menu__ver-arrow la la-angle-right"></i>
104
                            </a>
105
                            <div class="m-menu__submenu m-menu__submenu--classic m-menu__submenu--right">
106
                                <span class="m-menu__arrow m-menu__arrow--adjust"></span>
107
                                <ul class="m-menu__subnav">
108
                                    ' . $this->getChildMenuItems($item) . '
109
                                </ul>
110
                            </div>
111
                        </li>' . PHP_EOL;
112
    }
113
}
114