/** * @return Array list of all member objects, if some of them are groups, they are exploded and their members inserted */ public function &expand($keepGroupsInList = false) { $ret = array(); foreach ($this->members as $object) { if ($object->isGroup()) { $ret = array_merge($ret, $object->expand()); if ($keepGroupsInList) { $ret[] = $object; } } else { $ret[] = $object; } } $ret = array_unique_no_cast($ret); return $ret; }
/** * @return Address[]|AddressGroup[] */ public function &membersExpanded($keepGroupsInList = false) { $localA = array(); if (count($this->o) == 0) { return $localA; } foreach ($this->o as $member) { if ($member->isGroup()) { $flat = $member->expand($keepGroupsInList); $localA = array_merge($localA, $flat); if ($keepGroupsInList) { $localA[] = $member; } } else { $localA[] = $member; } } $localA = array_unique_no_cast($localA); return $localA; }