nWidart /
laravel-menus
| 1 | <?php |
||||
| 2 | |||||
| 3 | /* |
||||
| 4 | * Horizontal Menu for Metronic by KeenThemes (https://keenthemes.com/metronic/) |
||||
| 5 | * Author: Christian David ([email protected]) |
||||
| 6 | * Description: Generate horizontal menu to metronic theme |
||||
| 7 | */ |
||||
| 8 | |||||
| 9 | namespace KyleMassacre\Menus\Presenters\Metronic; |
||||
| 10 | |||||
| 11 | use KyleMassacre\Menus\Contracts\MenuItemContract; |
||||
| 12 | use KyleMassacre\Menus\Presenters\Presenter; |
||||
| 13 | |||||
| 14 | class MetronicHorizontalMenuPresenter extends Presenter |
||||
| 15 | { |
||||
| 16 | /** |
||||
| 17 | * {@inheritdoc } |
||||
| 18 | */ |
||||
| 19 | public function getOpenTagWrapper(): ?string |
||||
| 20 | { |
||||
| 21 | return PHP_EOL . '<ul class="m-menu__nav m-menu__nav--submenu-arrow ">' . PHP_EOL; |
||||
| 22 | } |
||||
| 23 | |||||
| 24 | /** |
||||
| 25 | * {@inheritdoc } |
||||
| 26 | */ |
||||
| 27 | public function getCloseTagWrapper(): ?string |
||||
| 28 | { |
||||
| 29 | return PHP_EOL . '</ul>' . PHP_EOL; |
||||
| 30 | } |
||||
| 31 | |||||
| 32 | /** |
||||
| 33 | * {@inheritdoc } |
||||
| 34 | */ |
||||
| 35 | public function getMenuWithoutDropdownWrapper(MenuItemContract $item): ?string |
||||
| 36 | { |
||||
| 37 | return '<li ' . $this->getActiveState($item) . '>' . $item->getIcon() . '<a href="' . $item->getUrl() . '" class="m-menu__link"><span class="m-menu__item-here"></span><span class="m-menu__link-text">' . $item->title . '</span></a></li>'; |
||||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
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
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...
|
|||||
| 38 | } |
||||
| 39 | |||||
| 40 | /** |
||||
| 41 | * {@inheritdoc } |
||||
| 42 | */ |
||||
| 43 | public function getActiveState(MenuItemContract $item): string |
||||
| 44 | { |
||||
| 45 | return \Request::is($item->getRequest()) ? ' class="m-menu__item m-menu__item--rel active"' : 'class="m-menu__item m-menu__item--rel"'; |
||||
| 46 | } |
||||
| 47 | |||||
| 48 | /** |
||||
| 49 | * {@inheritdoc } |
||||
| 50 | */ |
||||
| 51 | public function getDividerWrapper(): ?string |
||||
| 52 | { |
||||
| 53 | return ''; |
||||
| 54 | } |
||||
| 55 | |||||
| 56 | /** |
||||
| 57 | * {@inheritdoc } |
||||
| 58 | */ |
||||
| 59 | public function getMenuWithDropDownWrapper(MenuItemContract $item): ?string |
||||
| 60 | { |
||||
| 61 | if ($item->title == '...') { |
||||
|
0 ignored issues
–
show
The property
title does not exist on KyleMassacre\Menus\Contracts\MenuItemContract. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 62 | return '<li class="m-menu__item m-menu__item--submenu m-menu__item--rel" data-menu-submenu-toggle="click" aria-haspopup="true"> |
||||
| 63 | <a href="#" class="m-menu__link m-menu__toggle"> |
||||
| 64 | <span class="m-menu__item-here"></span> |
||||
| 65 | <i class="m-menu__link-icon flaticon-more-v3"></i> |
||||
| 66 | <span class="m-menu__link-text"></span> |
||||
| 67 | </a> |
||||
| 68 | <div class="m-menu__submenu m-menu__submenu--classic m-menu__submenu--left m-menu__submenu--pull"> |
||||
| 69 | <span class="m-menu__arrow m-menu__arrow--adjust"></span> |
||||
| 70 | <ul class="m-menu__subnav"> |
||||
| 71 | ' . $this->getChildMenuItems($item) . ' |
||||
| 72 | </ul> |
||||
| 73 | </div> |
||||
| 74 | </li>' . PHP_EOL; |
||||
| 75 | } else { |
||||
| 76 | return '<li class="m-menu__item m-menu__item--submenu m-menu__item--rel" data-menu-submenu-toggle="click" aria-haspopup="true"> |
||||
| 77 | <a href="#" class="m-menu__link m-menu__toggle"> |
||||
| 78 | ' . $item->getIcon() . ' |
||||
|
0 ignored issues
–
show
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
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...
|
|||||
| 79 | <span class="m-menu__link-text"> |
||||
| 80 | ' . $item->title . ' |
||||
| 81 | </span> |
||||
| 82 | <i class="m-menu__hor-arrow la la-angle-down"></i> |
||||
| 83 | <i class="m-menu__ver-arrow la la-angle-right"></i> |
||||
| 84 | </a> |
||||
| 85 | <div class="m-menu__submenu m-menu__submenu--classic m-menu__submenu--left"> |
||||
| 86 | <span class="m-menu__arrow m-menu__arrow--adjust"></span> |
||||
| 87 | <ul class="m-menu__subnav"> |
||||
| 88 | ' . $this->getChildMenuItems($item) . ' |
||||
| 89 | </ul> |
||||
| 90 | </div> |
||||
| 91 | </li>' . PHP_EOL; |
||||
| 92 | } |
||||
| 93 | } |
||||
| 94 | |||||
| 95 | public function getMultiLevelDropdownWrapper(MenuItemContract $item): string |
||||
| 96 | { |
||||
| 97 | return '<li class="m-menu__item m-menu__item--submenu" data-menu-submenu-toggle="hover" data-redirect="true" aria-haspopup="true"> |
||||
| 98 | <a href="#" class="m-menu__link m-menu__toggle"> |
||||
| 99 | ' . $item->getIcon() . ' |
||||
|
0 ignored issues
–
show
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
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...
|
|||||
| 100 | <span class="m-menu__link-text"> |
||||
| 101 | ' . $item->title . ' |
||||
|
0 ignored issues
–
show
The property
title does not exist on KyleMassacre\Menus\Contracts\MenuItemContract. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 102 | </span> |
||||
| 103 | <i class="m-menu__hor-arrow la la-angle-right"></i> |
||||
| 104 | <i class="m-menu__ver-arrow la la-angle-right"></i> |
||||
| 105 | </a> |
||||
| 106 | <div class="m-menu__submenu m-menu__submenu--classic m-menu__submenu--right"> |
||||
| 107 | <span class="m-menu__arrow m-menu__arrow--adjust"></span> |
||||
| 108 | <ul class="m-menu__subnav"> |
||||
| 109 | ' . $this->getChildMenuItems($item) . ' |
||||
| 110 | </ul> |
||||
| 111 | </div> |
||||
| 112 | </li>' . PHP_EOL; |
||||
| 113 | } |
||||
| 114 | } |
||||
| 115 |