protected function _toTurbaObjects(array $objects, array $sort_order = null)
{
$list = new Turba_List();
foreach ($objects as $object) {
/* Translate the driver-specific fields in the result back to the
* more generalized common Turba attributes using the map. */
$object = $this->toTurbaKeys($object);
$done = false;
if (!empty($object['__type']) && ucwords($object['__type']) != 'Object') {
$class = 'Turba_Object_' . ucwords($object['__type']);
if (class_exists($class)) {
$list->insert(new $class($this, $object, $this->_objectOptions));
$done = true;
}
}
if (!$done) {
$list->insert(new Turba_Object($this, $object, $this->_objectOptions));
}
}
$list->sort($sort_order);
/* Return the filtered (sorted) results. */
return $list;
}