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

Presenter::getCloseTagWrapper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace KyleMassacre\Menus\Presenters;
4
5
use KyleMassacre\Menus\Contracts\MenuItemContract;
6
7
abstract class Presenter implements PresenterInterface
8
{
9
    /**
10
     * Get open tag wrapper.
11
     *
12
     * @return string
13
     */
14
    public function getOpenTagWrapper(): ?string
15
    {
16
    }
17
18
    /**
19
     * Get close tag wrapper.
20
     *
21
     * @return string
22
     */
23
    public function getCloseTagWrapper(): ?string
24
    {
25
    }
26
27
    /**
28
     * Get menu tag without dropdown wrapper.
29
     *
30
     * @param MenuItemContract $item
31
     *
32
     * @return string
33
     */
34
    public function getMenuWithoutDropdownWrapper(MenuItemContract $item): ?string
35
    {
36
    }
37
38
    /**
39
     * Get divider tag wrapper.
40
     *
41
     * @return string
42
     */
43
    public function getDividerWrapper(): ?string
44
    {
45
    }
46
47
    /**
48
     * Get header dropdown tag wrapper.
49
     *
50
     * @param MenuItemContract $item
51
     *
52
     * @return null|string
53
     */
54
    public function getHeaderWrapper(MenuItemContract $item): ?string
55
    {
56
    }
57
58
    /**
59
     * Get menu tag with dropdown wrapper.
60
     *
61
     * @param \KyleMassacre\Menus\MenuItem $item
62
     *
63
     * @return string
64
     */
65
    public function getMenuWithDropDownWrapper(MenuItemContract $item): ?string
66
    {
67
    }
68
69
    /**
70
     * Get multi level dropdown menu wrapper.
71
     *
72
     * @param \KyleMassacre\Menus\MenuItem $item
73
     *
74
     * @return string
75
     */
76
    public function getMultiLevelDropdownWrapper(MenuItemContract $item): string
77
    {
78
    }
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
79
80
    /**
81
     * Get child menu items.
82
     *
83
     * @param \KyleMassacre\Menus\MenuItem $item
84
     *
85
     * @return string
86
     */
87
    public function getChildMenuItems(MenuItemContract $item): string
88
    {
89
        $results = '';
90
        foreach ($item->getChildren() as $child) {
91
            if ($child->hidden()) {
92
                continue;
93
            }
94
95
            if ($child->hasSubMenu()) {
96
                $results .= $this->getMultiLevelDropdownWrapper($child);
97
            } elseif ($child->isHeader()) {
98
                $results .= $this->getHeaderWrapper($child);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->getHeaderWrapper($child) targeting KyleMassacre\Menus\Prese...ter::getHeaderWrapper() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
99
            } elseif ($child->isDivider()) {
100
                $results .= $this->getDividerWrapper();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->getDividerWrapper() targeting KyleMassacre\Menus\Prese...er::getDividerWrapper() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
101
            } else {
102
                $results .= $this->getMenuWithoutDropdownWrapper($child);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->getMenuWithoutDropdownWrapper($child) targeting KyleMassacre\Menus\Prese...ithoutDropdownWrapper() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
103
            }
104
        }
105
106
        return $results;
107
    }
108
}
109