| @@ 60-75 (lines=16) @@ | ||
| 57 | /** |
|
| 58 | * {@inheritdoc} |
|
| 59 | */ |
|
| 60 | public function convert($xmlDocument) |
|
| 61 | { |
|
| 62 | $stream = @fopen($this->options['stream'], 'r+b'); |
|
| 63 | ||
| 64 | if (false === $stream) { |
|
| 65 | throw new StreamAdapterException(sprintf('Unable to acquire resource handler on "%s".', $this->options['stream'])); |
|
| 66 | } |
|
| 67 | ||
| 68 | fwrite($stream, $xmlDocument->saveXML($this->options['save_xml_options'])); |
|
| 69 | ||
| 70 | if (false === @rewind($stream)) { |
|
| 71 | throw new StreamAdapterException('Unable to to rewind stream.'); |
|
| 72 | } |
|
| 73 | ||
| 74 | return new $this->streamClass($stream); |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||
| @@ 59-74 (lines=16) @@ | ||
| 56 | /** |
|
| 57 | * {@inheritdoc} |
|
| 58 | */ |
|
| 59 | public function convert($xmlDocument) |
|
| 60 | { |
|
| 61 | $stream = @fopen($this->options['stream'], 'r+b'); |
|
| 62 | ||
| 63 | if (false === $stream) { |
|
| 64 | throw new StreamAdapterException(sprintf('Unable to acquire resource handler on "%s".', $this->options['stream'])); |
|
| 65 | } |
|
| 66 | ||
| 67 | fwrite($stream, $xmlDocument->asXML()); |
|
| 68 | ||
| 69 | if (false === @rewind($stream)) { |
|
| 70 | throw new StreamAdapterException('Unable to to rewind stream.'); |
|
| 71 | } |
|
| 72 | ||
| 73 | return new $this->streamClass($stream); |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||