original_string: protected static function _findBoundary($text, $pos, $boundary,
                                              $end = null)
      {
          $i = 0;
          $out = array();
  
          $search = "--" . $boundary;
          $search_len = strlen($search);
  
          while (($pos = strpos($text, $search, $pos)) !== false) {
              /* Boundary needs to appear at beginning of string or right after
               * a LF. */
              if (($pos != 0) && ($text[$pos - 1] != "\n")) {
                  continue;
              }
  
              if (isset($out[$i])) {
                  $out[$i]['length'] = $pos - $out[$i]['start'] - 1;
              }
  
              if (!is_null($end) && ($end == $i)) {
                  break;
              }
  
              $pos += $search_len;
              if (isset($text[$pos])) {
                  switch ($text[$pos]) {
                  case "\r":
                      $pos += 2;
                      $out[++$i] = array('start' => $pos);
                      break;
  
                  case "\n":
                      $out[++$i] = array('start' => ++$pos);
                      break;
  
                  case '-':
                      return $out;
                  }
              }
          }
  
          return $out;
      }
code: protected static function _findBoundary($text, $pos, $boundary,
                                              $end = null)
      {
          $i = 0;
          $out = array();
  
          $search = "--" . $boundary;
          $search_len = strlen($search);
  
          while (($pos = strpos($text, $search, $pos)) !== false) {
              /* Boundary needs to appear at beginning of string or right after
               * a LF. */
              if (($pos != 0) && ($text[$pos - 1] != "\n")) {
                  continue;
              }
  
              if (isset($out[$i])) {
                  $out[$i]['length'] = $pos - $out[$i]['start'] - 1;
              }
  
              if (!is_null($end) && ($end == $i)) {
                  break;
              }
  
              $pos += $search_len;
              if (isset($text[$pos])) {
                  switch ($text[$pos]) {
                  case "\r":
                      $pos += 2;
                      $out[++$i] = array('start' => $pos);
                      break;
  
                  case "\n":
                      $out[++$i] = array('start' => ++$pos);
                      break;
  
                  case '-':
                      return $out;
                  }
              }
          }
  
          return $out;
      }
code_tokens: protected static function _findBoundary ( $ text , $ pos , $ boundary , $ end = null ) { $ i = 0 ; $ out = array ( ) ; $ search = "--" . $ boundary ; $ search_len = strlen ( $ search ) ; while ( ( $ pos = strpos ( $ text , $ search , $ pos ) ) !== false ) { /* Boundary needs to appear at beginning of string or right after
               * a LF. */ if ( ( $ pos != 0 ) && ( $ text [ $ pos - 1 ] != "\n" ) ) { continue ; } if ( isset ( $ out [ $ i ] ) ) { $ out [ $ i ] [ 'length' ] = $ pos - $ out [ $ i ] [ 'start' ] - 1 ; } if ( ! is_null ( $ end ) && ( $ end == $ i ) ) { break ; } $ pos += $ search_len ; if ( isset ( $ text [ $ pos ] ) ) { switch ( $ text [ $ pos ] ) { case "\r" : $ pos += 2 ; $ out [ ++ $ i ] = array ( 'start' => $ pos ) ; break ; case "\n" : $ out [ ++ $ i ] = array ( 'start' => ++ $ pos ) ; break ; case '-' : return $ out ; } } } return $ out ; }
docstring: Find the location of the next boundary string.
  
  @param string $text      The text to search.
  @param integer $pos      The current position in $text.
  @param string $boundary  The boundary string.
  @param integer $end      If set, return after matching this many
  boundaries.
  
  @return array  Keys are the boundary number, values are an array with
  two elements: 'start' and 'length'.
docstring_tokens: Find the location of the next boundary string .