/** * {@inheritdoc} */ public function writeLine($content) { $size = fwrite($this->getResource(), $content . $this->lineBreak); if (false === $size) { ResourceErrorException::writingFailed($this->getResource()); } return $this; }
/** * Closes bound resource if exists. * * @return Worker Current instance * * @throws ResourceErrorException If resource could not be closed */ public function close() { if (null !== $this->resource) { if (fclose($this->resource)) { $this->resource = null; } else { throw ResourceErrorException::closingFailed($this->resource); } } return $this; }