Get an array of member values for a given member for the array of objects passed
using the same indexing system as the passed objects.

@static
@param $member
@param $objects
764223
public static function getMemberValueArrayForObjects($member, $objects) {

        $returnValues = array();

        foreach ($objects as $key => $value) {

            if (is_object($value)) {
                if ($value instanceof SerialisableObject) {
                    $returnValues[$key] = $value->__getSerialisablePropertyValue($member);
                } else {
                    throw new ClassNotSerialisableException(get_class($value));
                }
            }
        }

        return $returnValues;

    }
1239208
public static function createFromObjects(array $objects = null)
    {
        if ($objects === null) {
            return null;
        }

        $collection = new static();

        foreach ($objects as $v) {
            if (!($v instanceof Contact) && ($v instanceof stdClass)) {
                $part = new Contact();
                $part->updateFromObject($v);
            }

            $collection->add($v);
        }

        return $collection;
    }
134974
public static function filterArrayOfObjectsByMember($member, $objects, $filterValue) {

        $filterValues = is_array($filterValue) ? $filterValue : array($filterValue);

        $filteredObjects = array();

        foreach ($objects as $object) {
            if ($object instanceof SerialisableObject) {
                foreach ($filterValues as $value) {
                    if ($value == $object->__getSerialisablePropertyValue($member)) {
                        $filteredObjects[] = $object;
                        break;
                    }
                }
            } else {
                throw new ClassNotSerialisableException(get_class($object));
            }
        }

        return $filteredObjects;

    }
1244028
public function casMember($member, $oldValue, $newValue)
    {
        $set = false;

        $this->lock();
        if ($this[$member] == $oldValue) {
            $this[$member] = $newValue;

            $set = true;
        }
        $this->unlock();

        return $set;
    }
607047
private function getPropertyValue(RefClass $refClass, $member)
    {
        $member = substr($member, 1);

        if (!isset($refClass->properties[$member])) {
            throw new MarkupException(sprintf('property %s::$%s does not exist', $refClass->name, $member));
        }

        return $refClass->properties[$member]->default;
    }
855354
private function processSortBy($objects)
    {
        if (count($objects) > 0) {
            foreach ($objects as $key => $row) {
                if (array_key_exists($this->sortByField, $row)) {
                    $sort[$key] = $row[$this->sortByField];
                }
            }

            array_multisort($sort, $this->sortByDirection, $objects);
        }

        return $objects;
    }
926083
public void onMembersChange(Collection<Address> members) {
      Set<Address> currentMembers = new HashSet<>(members);
      this.currentMembers = currentMembers;
      for (BaseAckTarget<?> ackTarget : collectorMap.values()) {
         ackTarget.onMembersChange(currentMembers);
      }
   }
14752
public function updateMemberGroups($data, Member $member)
    {
        if (isset($data['memberof'])) {
            $ldapGroups = is_array($data['memberof']) ? $data['memberof'] : [$data['memberof']];
            foreach ($ldapGroups as $groupDN) {
                foreach (LDAPGroupMapping::get() as $mapping) {
                    if (!$mapping->DN) {
                        $this->getLogger()->debug(
                            sprintf(
                                'LDAPGroupMapping ID %s is missing DN field. Skipping',
                                $mapping->ID
                            )
                        );
                        continue;
                    }

                    // the user is a direct member of group with a mapping, add them to the SS group.
                    if ($mapping->DN == $groupDN) {
                        $group = $mapping->Group();
                        if ($group && $group->exists()) {
                            $group->Members()->add($member, [
                                'IsImportedFromLDAP' => '1'
                            ]);
                            $mappedGroupIDs[] = $mapping->GroupID;
                        }
                    }

                    // the user *might* be a member of a nested group provided the scope of the mapping
                    // is to include the entire subtree. Check all those mappings and find the LDAP child groups
                    // to see if they are a member of one of those. If they are, add them to the SS group
                    if ($mapping->Scope == 'Subtree') {
                        $childGroups = $this->getNestedGroups($mapping->DN, ['dn']);
                        if (!$childGroups) {
                            continue;
                        }

                        foreach ($childGroups as $childGroupDN => $childGroupRecord) {
                            if ($childGroupDN == $groupDN) {
                                $group = $mapping->Group();
                                if ($group && $group->exists()) {
                                    $group->Members()->add($member, [
                                        'IsImportedFromLDAP' => '1'
                                    ]);
                                    $mappedGroupIDs[] = $mapping->GroupID;
                                }
                            }
                        }
                    }
                }
            }
        }

        // Lookup the previous mappings and see if there is any mappings no longer present.
        $unmappedGroups = $member->Groups()->alterDataQuery(function (DataQuery $query) {
            // join with the Group_Members table because we only want those group members assigned by this module.
            $query->leftJoin("Group_Members", '"Group_Members"."GroupID" = "Group"."ID"');
            $query->where('"Group_Members"."IsImportedFromLDAP" = 1');
        });

        // Don't remove associations which have just been added and we know are already correct!
        if (!empty($mappedGroupIDs)) {
            $unmappedGroups = $unmappedGroups->filter("GroupID:NOT", $mappedGroupIDs);
        }

        // Remove the member from any previously mapped groups, where the mapping
        // has since been removed in the LDAP data source
        if ($unmappedGroups->count()) {
            foreach ($unmappedGroups as $group) {
                $group->Members()->remove($member);
            }
        }
    }
438409
public function getFieldValue(string $member)
        {
        	$score = $this->_redis->zscore($this->_key, $member);
                return $score!==null ? $score: 0;
        }
1353659
protected function getAllowedRelations($class, $member = null)
    {
        $allowedRelations = [];
        $obj = singleton($class);
        $relations = (array)$obj->hasOne() + (array)$obj->hasMany() + (array)$obj->manyMany();
        if ($relations) {
            foreach ($relations as $relName => $relClass) {
                $relClass = static::parseRelationClass($relClass);

                //remove dot notation from relation names
                $parts = explode('.', $relClass);
                $relClass = array_shift($parts);
                if (Config::inst()->get($relClass, 'api_access')) {
                    $allowedRelations[] = $relName;
                }
            }
        }
        return $allowedRelations;
    }
877390
public void setMemberAccounts(java.util.Collection<String> memberAccounts) {
        if (memberAccounts == null) {
            this.memberAccounts = null;
            return;
        }

        this.memberAccounts = new java.util.ArrayList<String>(memberAccounts);
    }
1092925
public static function becauseUnknownMember(string $enum, string $member): EnumException
    {
        return new self(sprintf('Unknown member "%s" for enum %s', $member, $enum));
    }
814529
protected function loadObjectProperties(array $objects) : array
    {
        $objectProperties = [];

        foreach ($objects as $key => $object) {
            $objectProperties[$key] = $object->toArray();
        }

        // Load member expressions from object instances, eg 'some.nested.value'
        foreach ($this->definition->getPropertyComponentIdMap() as $memberExpression => $componentId) {
            if (strpos($memberExpression, '.') !== false || strpos($memberExpression, '(') !== null) {
                $memberGetter = $this->memberParser->parse($this->definition->getClass(), $memberExpression)->makeArrayGetterCallable();

                $values = $memberGetter($objects);
                foreach ($values as $key => $value) {
                    $objectProperties[$key][$memberExpression] = $value;
                }
            }
        }

        return $objectProperties;
    }
669610
public function sIsMember($key, $member) {
        return $this->send(['sismember', $key, $member], function ($response) {
            return (bool) $response;
        });
    }
1166464
static function MemberCheckList($name, Member $member)
    {    
        $field = new CheckList($name);
        self::AddMembergroupOptions($field);
        $groupIDs = Membergroup::GetKeyList(self::MemberMembergroups($member));
        $field->SetValue($groupIDs);
        return $field;
    }
601619
public static function add_group_members($members) {
        global $CFG, $DB;
        require_once("$CFG->dirroot/group/lib.php");

        $params = self::validate_parameters(self::add_group_members_parameters(), array('members'=>$members));

        $transaction = $DB->start_delegated_transaction();
        foreach ($params['members'] as $member) {
            // validate params
            $groupid = $member['groupid'];
            $userid = $member['userid'];

            $group = groups_get_group($groupid, '*', MUST_EXIST);
            $user = $DB->get_record('user', array('id'=>$userid, 'deleted'=>0, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);

            // now security checks
            $context = context_course::instance($group->courseid, IGNORE_MISSING);
            try {
                self::validate_context($context);
            } catch (Exception $e) {
                $exceptionparam = new stdClass();
                $exceptionparam->message = $e->getMessage();
                $exceptionparam->courseid = $group->courseid;
                throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
            }
            require_capability('moodle/course:managegroups', $context);

            // now make sure user is enrolled in course - this is mandatory requirement,
            // unfortunately this is slow
            if (!is_enrolled($context, $userid)) {
                throw new invalid_parameter_exception('Only enrolled users may be members of groups');
            }

            groups_add_member($group, $user);
        }

        $transaction->allow_commit();
    }
958491
public function remove( $member )
    {
        if( false !== $key = array_search( $member, $this->members, true ) ) {
            unset( $this->members[$key] );
        }
        return $this;
    }