/** * Create stream writer object * * @param StreamInterface $stream The stream to write to * * @throws Exception\InvalidArgumentException An exception will be thrown when the provided stream is not writable */ public function __construct(StreamInterface $stream) { if (!$stream->isWritable()) { throw new Exception\InvalidArgumentException('Stream is not writable'); } $this->stream = $stream; }