Example #1
0
 /**
  * {@inheritdoc}
  */
 public function writeLine($content)
 {
     $size = fwrite($this->getResource(), $content . $this->lineBreak);
     if (false === $size) {
         ResourceErrorException::writingFailed($this->getResource());
     }
     return $this;
 }
Example #2
0
 /**
  * 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;
 }