original_string: public function readUntil($end)
      {
          if (empty($end)) {
              throw new ResourceException("Empty string given to Reader::readUntil()");
          }
          fseek($this->resource, $this->readPosition);
          // Reading the first character (maybe blocking)
          $buffer = stream_get_contents($this->resource, 1);
          // saving the blocking mode
          $mode = $this->blocking();
          $size = strlen($end);
          $this->blocking(false);
          while (strlen($buffer) < $size || substr($buffer, -$size) != $end) {
              $c = stream_get_contents($this->resource, 1);
              if (empty($c)) {
                  break;
              }
              $buffer .= $c;
          }
          $this->blocking($mode);
          $this->readPosition = ftell($this->resource);
          return (substr($buffer, -$size) == $end)
              ? substr($buffer, 0, strlen($buffer) - $size)
              : $buffer;
      }
code: public function readUntil($end)
      {
          if (empty($end)) {
              throw new ResourceException("Empty string given to Reader::readUntil()");
          }
          fseek($this->resource, $this->readPosition);
          // Reading the first character (maybe blocking)
          $buffer = stream_get_contents($this->resource, 1);
          // saving the blocking mode
          $mode = $this->blocking();
          $size = strlen($end);
          $this->blocking(false);
          while (strlen($buffer) < $size || substr($buffer, -$size) != $end) {
              $c = stream_get_contents($this->resource, 1);
              if (empty($c)) {
                  break;
              }
              $buffer .= $c;
          }
          $this->blocking($mode);
          $this->readPosition = ftell($this->resource);
          return (substr($buffer, -$size) == $end)
              ? substr($buffer, 0, strlen($buffer) - $size)
              : $buffer;
      }
code_tokens: public function readUntil ( $ end ) { if ( empty ( $ end ) ) { throw new ResourceException ( "Empty string given to Reader::readUntil()" ) ; } fseek ( $ this -> resource , $ this -> readPosition ) ; // Reading the first character (maybe blocking) $ buffer = stream_get_contents ( $ this -> resource , 1 ) ; // saving the blocking mode $ mode = $ this -> blocking ( ) ; $ size = strlen ( $ end ) ; $ this -> blocking ( false ) ; while ( strlen ( $ buffer ) < $ size || substr ( $ buffer , - $ size ) != $ end ) { $ c = stream_get_contents ( $ this -> resource , 1 ) ; if ( empty ( $ c ) ) { break ; } $ buffer .= $ c ; } $ this -> blocking ( $ mode ) ; $ this -> readPosition = ftell ( $ this -> resource ) ; return ( substr ( $ buffer , - $ size ) == $ end ) ? substr ( $ buffer , 0 , strlen ( $ buffer ) - $ size ) : $ buffer ; }
docstring: Reads until the given string or the end of contents.
  Returns the read string without the ending string.
  
  @param  string $end
  @return string
  @throws ResourceException if the given $end is empty
docstring_tokens: Reads until the given string or the end of contents . Returns the read string without the ending string .