Completed
Push — master ( 12a2e2...71a5fb )
by Nicolas
12s
created

AdminltePresenter::getDividerWrapper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Nwidart\Menus\Presenters\Admin;
4
5
use Nwidart\Menus\Presenters\Presenter;
6
7 View Code Duplication
class AdminltePresenter extends Presenter
0 ignored issues
show
Duplication introduced by
This class 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...
8
{
9
    /**
10
     * {@inheritdoc }.
11
     */
12
    public function getOpenTagWrapper()
13
    {
14
        return PHP_EOL . '<ul class="sidebar-menu tree" data-widget="tree">' . PHP_EOL;
15
    }
16
17
    /**
18
     * {@inheritdoc }.
19
     */
20
    public function getCloseTagWrapper()
21
    {
22
        return PHP_EOL . '</ul>' . PHP_EOL;
23
    }
24
25
    /**
26
     * {@inheritdoc }.
27
     */
28
    public function getMenuWithoutDropdownWrapper($item)
29
    {
30
        return '<li' . $this->getActiveState($item) . '><a href="' . $item->getUrl() . '" ' . $item->getAttributes() . '>' . $item->getIcon() . ' <span>' . $item->title . '</span></a></li>' . PHP_EOL;
31
    }
32
33
    /**
34
     * {@inheritdoc }.
35
     */
36
    public function getActiveState($item, $state = ' class="active"')
37
    {
38
        return $item->isActive() ? $state : null;
39
    }
40
41
    /**
42
     * Get active state on child items.
43
     *
44
     * @param $item
45
     * @param string $state
46
     *
47
     * @return null|string
48
     */
49
    public function getActiveStateOnChild($item, $state = 'active')
50
    {
51
        return $item->hasActiveOnChild() ? $state : null;
52
    }
53
54
    /**
55
     * {@inheritdoc }.
56
     */
57
    public function getDividerWrapper()
58
    {
59
        return '<li class="divider"></li>';
60
    }
61
62
    /**
63
     * {@inheritdoc }.
64
     */
65
    public function getHeaderWrapper($item)
66
    {
67
        return '<li class="header">' . $item->title . '</li>';
68
    }
69
70
    /**
71
     * {@inheritdoc }.
72
     */
73
    public function getMenuWithDropDownWrapper($item)
74
    {
75
        return '<li class="treeview' . $this->getActiveStateOnChild($item, ' active') . '">
76
		          <a href="#">
77
					' . $item->getIcon() . ' <span>' . $item->title . '</span>
78
                    <span class="pull-right-container">
79
                      <i class="fa fa-angle-left pull-right"></i>
80
                    </span>
81
			      </a>
82
			      <ul class="treeview-menu">
83
			      	' . $this->getChildMenuItems($item) . '
84
			      </ul>
85
		      	</li>'
86
        . PHP_EOL;
87
    }
88
89
    /**
90
     * Get multilevel menu wrapper.
91
     *
92
     * @param \Nwidart\Menus\MenuItem $item
93
     *
94
     * @return string`
0 ignored issues
show
Documentation introduced by
The doc-type string` could not be parsed: Unknown type name "string`" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
95
     */
96
    public function getMultiLevelDropdownWrapper($item)
97
    {
98
        return '<li class="treeview' . $this->getActiveStateOnChild($item, ' active') . '">
99
		          <a href="#">
100
					' . $item->getIcon() . ' <span>' . $item->title . '</span>
101
			      	<span class="pull-right-container">
102
                      <i class="fa fa-angle-left pull-right"></i>
103
                    </span>
104
			      </a>
105
			      <ul class="treeview-menu">
106
			      	' . $this->getChildMenuItems($item) . '
107
			      </ul>
108
		      	</li>'
109
        . PHP_EOL;
110
    }
111
}
112