public function listMembers($sort = null)
{
$list = new Turba_List();
$children = unserialize($this->attributes['__members']);
if (!is_array($children)) {
$children = array();
}
reset($children);
$modified = false;
foreach ($children as $member) {
if (strpos($member, ':') === false) {
try {
$contact = $this->driver->getObject($member);
} catch (Horde_Exception_NotFound $e) {
if (!empty($this->_options['removeMissing'])) {
// Remove the contact if it no longer exists
$this->removeMember($member);
$modified = true;
}
continue;
}
} else {
list($sourceId, $contactId) = explode(':', $member, 2);
try {
$driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($sourceId);
} catch (Turba_Exception $e) {
continue;
}
try {
$contact = $driver->getObject($contactId);
} catch (Horde_Exception_NotFound $e) {
if (!empty($this->_options['removeMissing'])) {
// Remove the contact if it no longer exists
$this->removeMember($member);
$modified = true;
}
continue;
}
}
$list->insert($contact);
}
// If we've pruned any dead entries, store the changes.
if ($modified) {
$this->store();
}
$list->sort($sort);
return $list;
}