Retrieve an array of role types across all taxonomies

@return array
11337
public function getAllRoleTypes()
	{
		// Gather all role types
		return array_reduce( $this->context->importedSchemas, function( $carry, /** @var XBRL $taxonomy */ &$taxonomy )
		{
			$rts = $taxonomy->getRoleTypes();
			$taxonomy->normalizeUsedOn( $rts, $taxonomy );

			if ( count( $carry ) )
			{
				foreach ( $rts as $usedOn => $roles )
				{
					if ( isset( $carry[ $usedOn ] )  )
					{
						foreach ( $roles as $role => $details )
						{
							if ( ! isset( $carry[ $usedOn ][ $role ] ) )
							{
								$carry[ $usedOn ][ $role ] = $details;
							}
						}
					}
					else
					{
						$carry[ $usedOn ] = $roles;
					}
				}
			}
			else
			{
				$carry = $rts;
			}
			return $carry;
		}, array() );
	}
112273
public function getTypes()
    {
        return array_reduce(
            $this->_models,
            function ($result, $item) {
                $result[$item['type']] = $item['type'];
                return $result;
            },
            []
        );
    }
401198
public function getAllowedRoles()
    {
        $returnValue = array();

        $role = new core_kernel_classes_Resource(GenerisRdf::INSTANCE_ROLE_GENERIS);
        $returnValue = array($role->getUri() => $role);

        return (array) $returnValue;
    }
456281
public function getAllParentRoles()
    {
        $reducer = function (array $result, Role $role) {
            $result[$role->getIdentifier()] = $role;
            return array_merge($result, $role->getAllParentRoles());
        };

        return array_reduce($this->parentRoles, $reducer, []);
    }
804747
public function roleList()
    {
        $body = $this->request(self::URI_AUTH_ROLE_LIST);

        if ($this->pretty && isset($body['roles'])) {
            return $body['roles'];
        }

        return $body;
    }
885436
public function getRoles()
    {
        if (count($this->rolesStringAsArray) > 0) {
            return $this->rolesStringAsArray;
        }

        $roleNames = array();

        foreach ($this->getEntityRoles(true) as $role) {
            $roleNames[] = $role->getName();
        }

        return $roleNames;
    }
760815
public function getMembershipTypes() {
    $types = [];
    $membership_ids = $this->queryFactory->get('node')
      ->condition('type', 'membership')
      ->condition('status', 1)
      ->execute();

    if (!$membership_ids) {
      return $types;
    }

    $storage = $this->entityTypeManager->getStorage('node');
    $builder = $this->entityTypeManager->getViewBuilder('node');
    $memberships = $storage->loadMultiple($membership_ids);

    foreach ($memberships as $membership) {
      $membership_id = $membership->id();
      $types[$membership_id] = [
        'title' => $membership->title->value,
        'description' => $builder->view($membership, 'calc_preview'),
      ];
    }

    return $types;
  }
504655
public function getTypes()
    {
        $classes = parent::getTypes();

        foreach ($classes as $k => &$definition) {

            if (empty($definition[$k]['properties'])) {
                unset($classes[$k]);
                continue;
            }

            $properties = array_filter(array_map(function ($property) {

                if (!empty($property['validation'])) {


                    foreach ($property['validation'] as &$rule){
                        foreach ($rule as $type => &$item) {

                            if ($type === 'Valid') {
                                continue;
                            } else {
                                if (!is_array($item)){
                                    $item = [];
                                }
                                $item['groups'] = ['xsd_rules'];
                            }

                        }
                        unset($item);
                    }
                    unset($rule);

                    return $property['validation'];
                }


                return null;
            }, $definition[$k]['properties']));

            if (empty($properties)) {
                unset($classes[$k]);
                continue;
            }

            $definition[$k] = [
                'properties' => $properties
            ];
        }

        return $classes;
    }
1045885
public function getAllRoleIds()
    {
        $ids = array();
        foreach ($this->getAllRoles() as $role) {
            $ids[] = $role->getId();
        }
        return $ids;
    }
611689
public function getAllArcRoleTypes()
	{
		// Gather all arcrole types
		return array_reduce( $this->context->importedSchemas, function( $carry, &$taxonomy )
		{
			$arts = $taxonomy->getArcroleTypes();
			$taxonomy->normalizeUsedOn( $arts, $taxonomy );

			if ( count( $carry ) )
			{
				foreach ( $arts as $usedOn => $arcroles )
				{
					if ( isset( $carry[ $usedOn ] )  )
					{
						foreach ( $arcroles as $arcrole => $details )
						{
							if ( ! isset( $carry[ $usedOn ][ $arcrole ] ) )
							{
								$carry[ $usedOn ][ $arcrole ] = $details;
							}
						}
					}
					else
					{
						$carry[ $usedOn ] = $arcroles;
					}
				}
			}
			else
			{
				$carry = $arts;
			}
			return $carry;
		}, array() );
	}
876229
public function getGroups($role = 'all')
	{
		static $groups;

		if (!isset($groups))
		{
			$groups = array(
				'applicants' => array(),
				'invitees'   => array(),
				'members'    => array(),
				'managers'   => array(),
				'all'        => array()
			);
			$groups['all'] = Helper::getGroups($this->get('uidNumber'), 'all', 1);

			if ($groups['all'])
			{
				foreach ($groups['all'] as $item)
				{
					if ($item->registered)
					{
						if (!$item->regconfirmed)
						{
							$groups['applicants'][] = $item;
						}
						else
						{
							if ($item->manager)
							{
								$groups['managers'][] = $item;
							}
							else
							{
								$groups['members'][] = $item;
							}
						}
					}
					else
					{
						$groups['invitees'][] = $item;
					}
				}
			}
		}

		if ($role)
		{
			return (isset($groups[$role])) ? $groups[$role] : false;
		}

		return $groups;
	}
1153775
protected function _getRoleNames()
    {
        $names = [];
        if (!$this->has('roles')) {
            return $names;
        }
        foreach ($this->roles as $k => $role) {
            $names[] = $role->name;
        }

        return $names;
    }
271745
public function getMentionRolesAttribute()
    {
        $roles = new Collection([], 'id');

        foreach ($this->channel->guild->roles as $role) {
            if (array_search($role->id, $this->attributes['mention_roles']) !== false) {
                $roles->push($role);
            }
        }

        return $roles;
    }
1105173
public function viewRoles()
    {
        $contenttypes = $this->getOption('contenttypes');
        $permissions = $this->app['permissions']->getContentTypePermissions();
        $effectivePermissions = [];
        foreach ($contenttypes as $contenttype) {
            foreach (array_keys($permissions) as $permission) {
                $effectivePermissions[$contenttype['slug']][$permission] =
                    $this->app['permissions']->getRolesByContentTypePermission($permission, $contenttype['slug']);
            }
        }
        $globalPermissions = $this->app['permissions']->getGlobalRoles();

        $context = [
            'effective_permissions' => $effectivePermissions,
            'global_permissions'    => $globalPermissions,
        ];

        return $this->render('@bolt/roles/roles.twig', $context);
    }
1157381
public function getRoles() {
		if ( $this->cacheEnabled() ) {
			if ( is_null( $this->getCachedRoles() ) ) {
				Cache::remember( 'roles.user_' . $this->id, config( 'roles.cache.expiry' ), function () {
					return $this->roles()->get();
				} );
			}

			return $this->getCachedRoles();
		} else {
			return $this->roles()->get();
		}
	}
208538
public function getAllDimensions()
	{
		// Gather all arcrole types
		return array_reduce( $this->context->importedSchemas, function( $carry, /** @var XBRL $taxonomy */ &$taxonomy )
		{
			$dimensionNames = $taxonomy->getElementDimensions();
			$dimensionElements = array();

			foreach ( $dimensionNames as $dimensionName )
			{
				$element = $taxonomy->getElementByName( $dimensionName );
				$element['namespace'] = $taxonomy->getNamespace();
				$dimensionElements[ "{$taxonomy->getTaxonomyXSD()}#{$element['id']}" ] = $element;
			}

			$carry = array_merge( $carry, $dimensionElements );

			return $carry;
		}, array() );
	}
907989
public function getRolesForUserCreation(): array
    {
        $roles = [];

        if (auth()->check()) {
            /** @var HCUser $user */
            $user = auth()->user();

            if ($user->isSuperAdmin()) {
                $roles = HCAclRole::select('id', 'name as label')->orderBy('name')->get()->toArray();
            } else {
                foreach ($user->roles as $role) {
                    $roles[] = [
                        'id' => $role->id,
                        'label' => $role->name,
                    ];
                }
            }
        }

        return $roles;
    }