| Conditions | 3 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 45 | protected function renderItem( MenuItemInterface $item ) |
||
| 46 | { |
||
| 47 | /** |
||
| 48 | * @var $item Item |
||
| 49 | */ |
||
| 50 | $menuItem = [ |
||
| 51 | 'title' => $item->getTitle(), |
||
| 52 | 'link' => $item->getLink(), |
||
| 53 | 'active' => $item->isActive(), |
||
| 54 | ]; |
||
| 55 | |||
| 56 | if( $item->hasSubMenu() ) |
||
| 57 | { |
||
| 58 | $menuItem['children'] = $this->renderMenu( $item->getSubMenu() ); |
||
| 59 | } |
||
| 60 | |||
| 61 | if( $item->hasBadge() ) |
||
| 62 | { |
||
| 63 | $menuItem['badge'] = $this->renderBadge( $item->getBadge() ); |
||
|
|
|||
| 64 | } |
||
| 65 | |||
| 66 | return array_filter( $menuItem ); |
||
| 67 | } |
||
| 68 | |||
| 81 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: