| Conditions | 7 |
| Paths | 6 |
| Total Lines | 27 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 33 | protected function getAdminMenu($list) |
||
| 34 | { |
||
| 35 | $menus = collect(); |
||
| 36 | foreach ($list as $key => $items) { |
||
| 37 | if (is_string($items)) { |
||
| 38 | $config = $this->configFactory->make($items); |
||
| 39 | if ($config && $config->getAttribute('permission')) { |
||
| 40 | $menus->push([ |
||
| 41 | 'title' => $config->getAttribute('title'), |
||
| 42 | 'url' => $this->getRouteUrl('admin.' . $items), |
||
| 43 | 'child' => [], |
||
| 44 | ]); |
||
| 45 | } |
||
| 46 | } elseif (is_array($items)) { // child |
||
| 47 | $childs = $this->getAdminMenu($items); |
||
| 48 | if ($childs->isNotEmpty()) { |
||
| 49 | $menu = [ |
||
| 50 | 'title' => $key, |
||
| 51 | 'url' => '/#', |
||
| 52 | 'child' => $childs, |
||
| 53 | ]; |
||
| 54 | $menus->push($menu); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 | return $menus; |
||
| 59 | } |
||
| 60 | |||
| 68 |