tube = new PBA\Values\TubeName($tubeName); } protected PBA\Values\TubeName $tube; public function set(string $value, int $delay = 0): self { $this->client->useTube($this->tube); $this->client->put($value, self::DEFAULT_PRIORITY, $delay, self::DEFAULT_TTR); return $this; } public function exists(): bool { $stats = $this->client->statsTube($this->tube); return $stats->currentJobsReady > 0; } protected int $currentJobId; public function get(): string { $this->client->useTube($this->tube); $job = $this->client->reserve(); $this->currentJobId = $job->getId(); return $job->getData(); } public function update(string $newPayload, ?int $jobId = null): self { if ($jobId === null) { $jobId = $this->currentJobId; } $this->remove($jobId); $this->set($newPayload); return $this; } public function remove(?int $jobId = null): self { if ($jobId === null) { $jobId = $this->currentJobId; } $this->client->useTube($this->tube); $this->client->delete(new PBA\Values\JobId($jobId)); return $this; } }