Passed
Pull Request — master (#57)
by Kyle
06:09
created

NavbarRightPresenter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 48.15 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 13
loc 27
ccs 0
cts 17
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getOpenTagWrapper() 0 3 1
A getMenuWithDropDownWrapper() 0 12 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace KyleMassacre\Menus\Presenters\Bootstrap;
4
5
class NavbarRightPresenter extends NavbarPresenter
6
{
7
    /**
8
     * {@inheritdoc }.
9
     */
10
    public function getOpenTagWrapper()
11
    {
12
        return PHP_EOL . '<ul class="nav navbar-nav navbar-right">' . PHP_EOL;
13
    }
14
15
    /**
16
     * {@inheritdoc }.
17
     */
18
    public function getMenuWithDropDownWrapper($item)
19
    {
20
        return '<li class="dropdown pull-right">
21
			      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
22
					' . $item->getIcon() . ' ' . $item->title . '
23
			      	<b class="caret"></b>
24
			      </a>
25
			      <ul class="dropdown-menu">
26
			      	' . $this->getChildMenuItems($item) . '
27
			      </ul>
28
		      	</li>'
29
        . PHP_EOL;
30
    }
31
}
32