src/Security/Authorization.php
protected function getHierarchy($role, array $roleHierarchy)
    {
        $roles = [];
        if (array_key_exists($role, $roleHierarchy)) {
            $roleRoles = (array) $roleHierarchy[$role];
            foreach ($roleRoles as $role) {
                $roles = array_merge($roles, $this->getHierarchy($role, $roleHierarchy));
            }
            $roles = array_merge($roles, $roleRoles);
        }

        return $roles;
    }
protected function getHierarchy($role, array $roleHierarchy)
    {
        $roles = [];
        if (array_key_exists($role, $roleHierarchy)) {
            $roleRoles = (array) $roleHierarchy[$role];
            foreach ($roleRoles as $role) {
                $roles = array_merge($roles, $this->getHierarchy($role, $roleHierarchy));
            }
            $roles = array_merge($roles, $roleRoles);
        }

        return $roles;
    }
protected function getHierarchy ( $ role , array $ roleHierarchy ) { $ roles = [ ] ; if ( array_key_exists ( $ role , $ roleHierarchy ) ) { $ roleRoles = ( array ) $ roleHierarchy [ $ role ] ; foreach ( $ roleRoles as $ role ) { $ roles = array_merge ( $ roles , $ this -> getHierarchy ( $ role , $ roleHierarchy ) ) ; } $ roles = array_merge ( $ roles , $ roleRoles ) ; } return $ roles ; }
Get hierarchy for role
@param  string $role
@param  array  $roleHierarchy
@return array
Get hierarchy for role