Role/RoleHierarchy.php
protected function doGetReachableRoles(array $roles, $suffix = '')
    {
        if (0 === \count($roles)) {
            return $roles;
        }

        $item = null;
        $roles = $this->formatRoles($roles);
        $id = $this->getUniqueId($roles);

        if (null !== ($reachableRoles = $this->getCachedReachableRoles($id, $item))) {
            return $reachableRoles;
        }

        // build hierarchy
        /** @var string[] $reachableRoles */
        $reachableRoles = RoleUtil::formatNames(parent::getReachableRoles(RoleUtil::formatRoles($roles)));
        $isPermEnabled = true;

        if (null !== $this->eventDispatcher) {
            $event = new PreReachableRoleEvent($reachableRoles);
            $this->eventDispatcher->dispatch(ReachableRoleEvents::PRE, $event);
            $reachableRoles = $event->getReachableRoles();
            $isPermEnabled = $event->isPermissionEnabled();
        }

        return $this->getAllRoles($reachableRoles, $roles, $id, $item, $isPermEnabled, $suffix);
    }
protected function doGetReachableRoles(array $roles, $suffix = '')
    {
        if (0 === \count($roles)) {
            return $roles;
        }

        $item = null;
        $roles = $this->formatRoles($roles);
        $id = $this->getUniqueId($roles);

        if (null !== ($reachableRoles = $this->getCachedReachableRoles($id, $item))) {
            return $reachableRoles;
        }

        // build hierarchy
        /** @var string[] $reachableRoles */
        $reachableRoles = RoleUtil::formatNames(parent::getReachableRoles(RoleUtil::formatRoles($roles)));
        $isPermEnabled = true;

        if (null !== $this->eventDispatcher) {
            $event = new PreReachableRoleEvent($reachableRoles);
            $this->eventDispatcher->dispatch(ReachableRoleEvents::PRE, $event);
            $reachableRoles = $event->getReachableRoles();
            $isPermEnabled = $event->isPermissionEnabled();
        }

        return $this->getAllRoles($reachableRoles, $roles, $id, $item, $isPermEnabled, $suffix);
    }
protected function doGetReachableRoles ( array $ roles , $ suffix = '' ) { if ( 0 === \ count ( $ roles ) ) { return $ roles ; } $ item = null ; $ roles = $ this -> formatRoles ( $ roles ) ; $ id = $ this -> getUniqueId ( $ roles ) ; if ( null !== ( $ reachableRoles = $ this -> getCachedReachableRoles ( $ id , $ item ) ) ) { return $ reachableRoles ; } // build hierarchy /** @var string[] $reachableRoles */ $ reachableRoles = RoleUtil :: formatNames ( parent :: getReachableRoles ( RoleUtil :: formatRoles ( $ roles ) ) ) ; $ isPermEnabled = true ; if ( null !== $ this -> eventDispatcher ) { $ event = new PreReachableRoleEvent ( $ reachableRoles ) ; $ this -> eventDispatcher -> dispatch ( ReachableRoleEvents :: PRE , $ event ) ; $ reachableRoles = $ event -> getReachableRoles ( ) ; $ isPermEnabled = $ event -> isPermissionEnabled ( ) ; } return $ this -> getAllRoles ( $ reachableRoles , $ roles , $ id , $ item , $ isPermEnabled , $ suffix ) ; }
Returns an array of all roles reachable by the given ones.

@param string[] $roles  An array of roles
@param string   $suffix The role name suffix

@return string[] An array of role instances
Returns an array of all roles reachable by the given ones .