Lines
75.00%
3 / 4
Methods
75.00%
3 / 4
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| listSubscriptionIdsForWorker | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| listWorkerIds | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| isEmpty | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| 11 | final readonly class SubscriptionRoutes | |
| 12 | { | |
| 13 | /** @param array<int, SubscriptionIdCollection> $subscriptionIdsByWorker */ | |
| 14 | public function __construct(private array $subscriptionIdsByWorker = []) {} | |
| 15 | ||
| 16 | public function listSubscriptionIdsForWorker(WorkerId $workerId): SubscriptionIdCollection | |
| 17 | { | |
| 18 | return $this->subscriptionIdsByWorker[$workerId->value] ?? SubscriptionIdCollection::empty(); | |
| 19 | } | |
| 20 | ||
| 21 | public function listWorkerIds(): WorkerIdCollection | |
| 22 | { | |
| 23 | return WorkerIdCollection::fromList(array_map(WorkerId::fromInt(...), array_keys($this->subscriptionIdsByWorker))); | |
| 24 | } | |
| 25 | ||
| 26 | public function isEmpty(): bool | |
| 27 | { | |
| 28 | return $this->subscriptionIdsByWorker === []; | |
| 29 | } | |
| 30 | } |