original_string: protected function parseHandle($fh)
      {
          $state   = false;
          $single  = false;
          $ret     = array();
          do {
              $line = fgets($fh);
              if ($line === false) {
                  break;
              }
              $line = rtrim($line, "\n\r");
              if (!$state && $line === '') {
                  continue;
              }
              if ($line === '----') {
                  break;
              }
              if (strncmp('--#', $line, 3) === 0) {
                  // Comment
                  continue;
              } elseif (strncmp('--', $line, 2) === 0) {
                  // Multiline declaration
                  $state = trim($line, '- ');
                  if (!isset($ret[$state])) {
                      $ret[$state] = '';
                  }
                  continue;
              } elseif (!$state) {
                  $single = true;
                  if (strpos($line, ':') !== false) {
                      // Single-line declaration
                      list($state, $line) = explode(':', $line, 2);
                      $line = trim($line);
                  } else {
                      // Use default declaration
                      $state  = $this->default;
                  }
              }
              if ($single) {
                  $ret[$state] = $line;
                  $single = false;
                  $state  = false;
              } else {
                  $ret[$state] .= "$line\n";
              }
          } while (!feof($fh));
          return $ret;
      }
code: protected function parseHandle($fh)
      {
          $state   = false;
          $single  = false;
          $ret     = array();
          do {
              $line = fgets($fh);
              if ($line === false) {
                  break;
              }
              $line = rtrim($line, "\n\r");
              if (!$state && $line === '') {
                  continue;
              }
              if ($line === '----') {
                  break;
              }
              if (strncmp('--#', $line, 3) === 0) {
                  // Comment
                  continue;
              } elseif (strncmp('--', $line, 2) === 0) {
                  // Multiline declaration
                  $state = trim($line, '- ');
                  if (!isset($ret[$state])) {
                      $ret[$state] = '';
                  }
                  continue;
              } elseif (!$state) {
                  $single = true;
                  if (strpos($line, ':') !== false) {
                      // Single-line declaration
                      list($state, $line) = explode(':', $line, 2);
                      $line = trim($line);
                  } else {
                      // Use default declaration
                      $state  = $this->default;
                  }
              }
              if ($single) {
                  $ret[$state] = $line;
                  $single = false;
                  $state  = false;
              } else {
                  $ret[$state] .= "$line\n";
              }
          } while (!feof($fh));
          return $ret;
      }
code_tokens: protected function parseHandle ( $ fh ) { $ state = false ; $ single = false ; $ ret = array ( ) ; do { $ line = fgets ( $ fh ) ; if ( $ line === false ) { break ; } $ line = rtrim ( $ line , "\n\r" ) ; if ( ! $ state && $ line === '' ) { continue ; } if ( $ line === '----' ) { break ; } if ( strncmp ( '--#' , $ line , 3 ) === 0 ) { // Comment continue ; } elseif ( strncmp ( '--' , $ line , 2 ) === 0 ) { // Multiline declaration $ state = trim ( $ line , '- ' ) ; if ( ! isset ( $ ret [ $ state ] ) ) { $ ret [ $ state ] = '' ; } continue ; } elseif ( ! $ state ) { $ single = true ; if ( strpos ( $ line , ':' ) !== false ) { // Single-line declaration list ( $ state , $ line ) = explode ( ':' , $ line , 2 ) ; $ line = trim ( $ line ) ; } else { // Use default declaration $ state = $ this -> default ; } } if ( $ single ) { $ ret [ $ state ] = $ line ; $ single = false ; $ state = false ; } else { $ ret [ $ state ] .= "$line\n" ; } } while ( ! feof ( $ fh ) ) ; return $ ret ; }
docstring: Internal parser that acepts a file handle.
  @note While it's possible to simulate in-memory parsing by using
  custom stream wrappers, if such a use-case arises we should
  factor out the file handle into its own class.
  @param resource $fh File handle with pointer at start of valid string-hash
  block.
  @return array
docstring_tokens: Internal parser that acepts a file handle .