public function getDocument()
    {
        if ( feof( $this->stream ) )
        {
            return false;
        }

        $document = '';
        while ( ( ( $line = fgets( $this->stream ) ) !== false ) &&
                ( trim( $line ) !== '--' . $this->options['boundary'] ) &&
                ( trim( $line ) !== '--' . $this->options['boundary'] . '--' ) )
        {
            $document .= $line;
        }

        if ( trim( $document ) === '' )
        {
            return false;
        }

        return $this->parseDocument( ltrim( $document ) );
    }