src/Repositories/PermissionRepository.php
protected function filterNestedEmptyGroups(AclPresenceInterface $presence)
    {
        if ($presence['type'] !== AclPresenceType::GROUP) {
            return 1;
        }

        $permissions = $presence->permissions();

        if ( ! $permissions) {
            return 0;
        }

        if (is_string($permissions)) {
            return 1;
        }

        return count($permissions);
    }
protected function filterNestedEmptyGroups(AclPresenceInterface $presence)
    {
        if ($presence['type'] !== AclPresenceType::GROUP) {
            return 1;
        }

        $permissions = $presence->permissions();

        if ( ! $permissions) {
            return 0;
        }

        if (is_string($permissions)) {
            return 1;
        }

        return count($permissions);
    }
Removes any empty group children from a tree structure, returning
the number of non-group entries.

@param AclPresenceInterface $presence
@return int  the number of non-group children found on the levels below