Lines 100.00% 10 / 10
Methods 100.00% 4 / 4
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 zero 100.00% 1 / 1 100.00% 1 / 1 1
 plus 100.00% 7 / 7 100.00% 1 / 1 1
 withoutQueued 100.00% 1 / 1 100.00% 1 / 1 1
7final readonly class OutboxStatus
8{
9    public function __construct(
10        public int $queued,
11        public int $dropped,
12        public int $coalescedStateChanges,
13        public int $stateBatchesSent,
14        public int $largestStateBatch,
15    ) {}
16
17    public static function zero(): self
18    {
19        return new self(0, 0, 0, 0, 0);
20    }
21
22    public function plus(self $other): self
23    {
24        return new self(
25            queued: $this->queued + $other->queued,
26            dropped: $this->dropped + $other->dropped,
27            coalescedStateChanges: $this->coalescedStateChanges + $other->coalescedStateChanges,
28            stateBatchesSent: $this->stateBatchesSent + $other->stateBatchesSent,
29            largestStateBatch: max($this->largestStateBatch, $other->largestStateBatch),
30        );
31    }
32
33    public function withoutQueued(): self
34    {
35        return new self(0, $this->dropped, $this->coalescedStateChanges, $this->stateBatchesSent, $this->largestStateBatch);
36    }
37}