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
|
|||
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
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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
99 | } elseif ($child->isDivider()) { |
||
100 | $results .= $this->getDividerWrapper(); |
||
0 ignored issues
–
show
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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
101 | } else { |
||
102 | $results .= $this->getMenuWithoutDropdownWrapper($child); |
||
0 ignored issues
–
show
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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
103 | } |
||
104 | } |
||
105 | |||
106 | return $results; |
||
107 | } |
||
108 | } |
||
109 |
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: