Passed
Pull Request — master (#57)
by Kyle
08:38
created

NavbarRightPresenter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 25
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getOpenTagWrapper() 0 3 1
A getMenuWithDropDownWrapper() 0 12 1
1
<?php
2
3
namespace KyleMassacre\Menus\Presenters\Bootstrap;
4
5
use KyleMassacre\Menus\Contracts\MenuItemContract;
6
7
class NavbarRightPresenter extends NavbarPresenter
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function getOpenTagWrapper(): ?string
13
    {
14
        return PHP_EOL . '<ul class="nav navbar-nav navbar-right">' . PHP_EOL;
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function getMenuWithDropDownWrapper(MenuItemContract $item): ?string
21
    {
22
        return '<li class="dropdown pull-right">
23
			      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
24
					' . $item->getIcon() . ' ' . $item->title . '
0 ignored issues
show
Bug introduced by
The call to KyleMassacre\Menus\Contr...ItemContract::getIcon() has too few arguments starting with default. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
					' . $item->/** @scrutinizer ignore-call */ getIcon() . ' ' . $item->title . '

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
Bug Best Practice introduced by
The property title does not exist on KyleMassacre\Menus\Contracts\MenuItemContract. Since you implemented __get, consider adding a @property annotation.
Loading history...
25
			      	<b class="caret"></b>
26
			      </a>
27
			      <ul class="dropdown-menu">
28
			      	' . $this->getChildMenuItems($item) . '
29
			      </ul>
30
		      	</li>'
31
        . PHP_EOL;
32
    }
33
}
34