limit = $limit; } public static function singleWorker(): self { return new self(1); } public static function atMost(int $limit): self { return new self($limit); } public static function unlimited(): self { return new self(self::VALUE_UNLIMITED); } public function isUnlimited(): bool { return $this->limit === self::VALUE_UNLIMITED; } public function isReachedBy(int $amount): bool { if ($this->isUnlimited()) { return false; } return $amount >= $this->limit; } }