/** * Construct a new writable data handle. * * @param stream|null $stream The native stream handle, or null to create lazily from the filesystem path. * @param string|null $path The filesystem path, or null if the path is unknown. * @param Inline|null $renderer The YAML renderer to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct($stream = null, $path = null, Inline $renderer = null, Isolator $isolator = null) { parent::__construct($stream, $path, $isolator); if (null === $renderer) { $renderer = new Inline(); } $this->renderer = $renderer; }
/** * Construct a new readable data handle. * * @param stream|null $stream The native stream handle, or null to create lazily from the filesystem path. * @param string|null $path The filesystem path, or null if the path is unknown. * @param Parser|null $parser The YAML parser to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct($stream = null, $path = null, Parser $parser = null, Isolator $isolator = null) { parent::__construct($stream, $path, $isolator); if (null === $parser) { $parser = new Parser(); } $this->parser = $parser; $this->rewindOffset = 0; $this->isExhausted = false; $this->isExpanded = false; }
/** * Close this handle. * * @throws ReadException If closing the handle fails. * @throws ClosedHandleException If this handle is closed. */ public function close() { if ($this->dataWritten) { if (null === $this->handle) { $this->handle = $this->createAlignedHandle(); $this->handle->writeAll($this->rows); $this->handle->close(); } else { $this->handle->close(); } } else { parent::close(); } $this->setIsClosed(true); }