| Total Complexity | 15 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class SidebarItemHelper extends MenuItemHelper |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Checks if a menu item is a sidebar custom search box. |
||
| 9 | * |
||
| 10 | * @param mixed $item |
||
| 11 | * @return bool |
||
| 12 | */ |
||
| 13 | 54 | public static function isCustomSearch($item) |
|
| 14 | { |
||
| 15 | 54 | return isset($item['text'], $item['type']) |
|
| 16 | 54 | && $item['type'] === 'sidebar-custom-search'; |
|
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Checks if a menu item is a sidebar menu search box. |
||
| 21 | * |
||
| 22 | * @param mixed $item |
||
| 23 | * @return bool |
||
| 24 | */ |
||
| 25 | 54 | public static function isMenuSearch($item) |
|
| 26 | { |
||
| 27 | 54 | return isset($item['text'], $item['type']) |
|
| 28 | 54 | && $item['type'] === 'sidebar-menu-search'; |
|
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Checks if a menu item is a sidebar search item (legacy or new). |
||
| 33 | * |
||
| 34 | * @param mixed $item |
||
| 35 | * @return bool |
||
| 36 | */ |
||
| 37 | 54 | public static function isSearch($item) |
|
| 38 | { |
||
| 39 | 54 | return self::isLegacySearch($item) |
|
| 40 | 54 | || self::isCustomSearch($item) |
|
| 41 | 54 | || self::isMenuSearch($item); |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Checks if a menu item is accepted for the sidebar section. |
||
| 46 | * |
||
| 47 | * @param mixed $item |
||
| 48 | * @return bool |
||
| 49 | */ |
||
| 50 | 19 | public static function isAcceptedItem($item) |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Checks if a menu item is valid for the sidebar. |
||
| 60 | * |
||
| 61 | * @param mixed $item |
||
| 62 | * @return bool |
||
| 63 | */ |
||
| 64 | 19 | public static function isValidItem($item) |
|
| 70 | } |
||
| 71 | } |
||
| 72 |