ZurbMenuPresenter::getActiveState()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Nwidart\Menus\Presenters\Foundation;
4
5
use Nwidart\Menus\Presenters\Presenter;
6
7
class ZurbMenuPresenter extends Presenter
8
{
9
    /**
10
     * {@inheritdoc }
11
     */
12
    public function getOpenTagWrapper()
13
    {
14
        return  PHP_EOL . '<nav class="custom-main">
15
        <ul class="dropdown menu" data-dropdown-menu>' . PHP_EOL;
16
    }
17
18
    /**
19
     * {@inheritdoc }
20
     */
21
    public function getCloseTagWrapper()
22
    {
23
        return  PHP_EOL . '</ul></nav>' . PHP_EOL;
24
    }
25
26
    /**
27
     * {@inheritdoc }
28
     */
29
    public function getMenuWithoutDropdownWrapper($item)
30
    {
31
        return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '">' . $item->title . '</a></li>';
32
    }
33
34
    /**
35
     * {@inheritdoc }
36
     */
37
    public function getActiveState($item)
38
    {
39
        return \Request::is($item->getRequest()) ? ' class="is-active"' : null;
40
    }
41
42
    /**
43
     * {@inheritdoc }
44
     */
45
    public function getDividerWrapper()
46
    {
47
        return '<li class="divider"></li>';
48
    }
49
50
    /**
51
     * {@inheritdoc }
52
     */
53 View Code Duplication
    public function getMenuWithDropDownWrapper($item)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55
        return '<li class="dropdown dropdown-primary">
56
                    <a class="dropdown-toggle" href="#">' . $item->title . '</a>
57
                    <ul class="menu">
58
                      ' . $this->getChildMenuItems($item) . '
59
                    </ul>
60
                </li>' . PHP_EOL;
61
    }
62
63
    /**
64
     * {@inheritdoc }
65
     */
66 View Code Duplication
    public function getMultiLevelDropdownWrapper($item)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
    {
68
        return '<li>
69
                  <a href="#">' . $item->title . '</a>
70
                  <ul class="menu">
71
                    ' . $this->getChildMenuItems($item) . '
72
                  </ul>
73
                </li>' . PHP_EOL;
74
    }
75
}
76