| Conditions | 6 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | protected function buildRolesTree(RoleManagerInterface $role_manager) |
||
| 37 | { |
||
| 38 | $hierarchy = []; |
||
| 39 | $roles = $role_manager->getRoles(); |
||
| 40 | foreach ($roles as $role) { |
||
| 41 | if ($role instanceof RoleInterface) { |
||
| 42 | if ($role->getParent()) { |
||
| 43 | if (!isset($hierarchy[$role->getParent()->getName()])) { |
||
| 44 | $hierarchy[$role->getParent()->getName()] = []; |
||
| 45 | } |
||
| 46 | $hierarchy[$role->getParent()->getName()][] = $role->getName(); |
||
| 47 | } else { |
||
| 48 | if (!isset($hierarchy[$role->getName()])) { |
||
| 49 | $hierarchy[$role->getName()] = []; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | return $hierarchy; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |