original_string: 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();
  
          foreach ($in as $key => $val) {
              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);
      }
code: 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();
  
          foreach ($in as $key => $val) {
              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);
      }
code_tokens: 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 ( ) ; foreach ( $ in as $ key => $ val ) { 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 ) ; }
docstring: Create an IMAP message sequence string from a list of indices.
  
  Index Format: range_start:range_end,uid,uid2,...
  
  @param boolean $sort  Numerically sort the IDs before creating the
  range?
  
  @return string  The IMAP message sequence string.
docstring_tokens: Create an IMAP message sequence string from a list of indices .