/** * @param string $operation * @param int $value * * @return \Generator * * @throws \Icicle\File\Exception\FileException */ private function change(string $operation, int $value) : \Generator { if (!$this->isOpen()) { throw new FileException('The file has been closed.'); } try { return yield from $this->worker->enqueue(new Internal\FileTask($operation, [$this->path, $value])); } catch (TaskException $exception) { $this->close(); throw new FileException(sprintf('%s failed.', $operation), $exception); } }
/** * {@inheritdoc} */ public function enqueue(Task $task) : \Generator { return $this->worker->enqueue($task); }