Lines
100.00%
7 / 7
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| refuseSubscribers | 100.00% | 6 / 6 | 100.00% | 1 / 1 | 3 | ||
| 13 | final readonly class TriggerRejections | |
| 14 | { | |
| 15 | public function __construct( | |
| 16 | private SubscriptionRegistry $registry, | |
| 17 | private WorkerSlotRegistry $slots, | |
| 18 | ) {} | |
| 19 | ||
| 20 | public function refuseSubscribers(TriggerSpec $spec, string $reason): void | |
| 21 | { | |
| 22 | $routes = $this->registry->findRoutes(SubscriptionKind::Trigger, $spec->getSharingKey()); | |
| 23 | ||
| 24 | foreach ($routes->listWorkerIds() as $workerId) { | |
| 25 | $handle = $this->slots->findHandleForWorker($workerId); | |
| 26 | ||
| 27 | foreach ($routes->listSubscriptionIdsForWorker($workerId) as $subscriptionId) { | |
| 28 | $handle?->send(new SubscriptionAck($subscriptionId, false, $reason)); | |
| 29 | $this->registry->remove($subscriptionId); | |
| 30 | } | |
| 31 | } | |
| 32 | } | |
| 33 | } |