code: public function convert($xmlDocument)
      {
          $stream = @fopen($this->options['stream'], 'r+b');
  
          if (false === $stream) {
              throw new StreamAdapterException(sprintf('Unable to acquire resource handler on "%s".', $this->options['stream']));
          }
  
          fwrite($stream, $xmlDocument->asXML());
  
          if (false === @rewind($stream)) {
              throw new StreamAdapterException('Unable to to rewind stream.');
          }
  
          return new $this->streamClass($stream);
      }
docs: {@inheritdoc}