protected function _toSequenceString($sort = true)
{
if (empty($this->_ids)) {
return '';
}
$in = $this->_ids;
if ($sort && !$this->_sorted) {
$this->_sort($in);
}
$first = $last = array_shift($in);
$i = count($in) - 1;
$out = array();
reset($in);
while (list($key, $val) = each($in)) {
if ($last + 1 == $val) {
$last = $val;
}
if ($i == $key || $last != $val) {
if ($last == $first) {
$out[] = $first;
if ($i == $key) {
$out[] = $val;
}
} else {
$out[] = $first . ':' . $last;
if ($i == $key && $last != $val) {
$out[] = $val;
}
}
$first = $last = $val;
}
}
return empty($out) ? $first : implode(',', $out);
}