Lines 0.00% 0 / 8
Methods 0.00% 0 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 __construct 0.00% 0 / 1 0.00% 0 / 1 2
 publish 0.00% 0 / 7 0.00% 0 / 1 2
15final readonly class TopicPublisher
16{
17    public function __construct(
18        private Transport $transport,
19        private Clock $clock,
20        private AppActivityCounters $activityCounters,
21    ) {}
22
23    /** @throws TransportException */
24    public function publish(ResourceScope $scope, string $topic, TopicPayload $payload): void
25    {
26        $this->transport->send(new Publish(
27            topic: $topic,
28            payload: $payload->value,
29            publisherScope: $scope,
30            publishedAt: $this->clock->getNow(),
31        ));
32        $this->activityCounters->findOrCreateActivityForScope($scope)->recordPublish();
33    }
34}