Lines
100.00%
2 / 2
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| countDropped | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 12 | final readonly class MqttStatus | |
| 13 | { | |
| 14 | /** @param list<MqttDropCount> $dropped */ | |
| 15 | public function __construct( | |
| 16 | public ConnectionPhase $phase, | |
| 17 | public ?Instant $since, | |
| 18 | public int $reconnects, | |
| 19 | public ?Duration $lastOutage, | |
| 20 | public ?string $lastError, | |
| 21 | #[ListOf(MqttDropCount::class)] | |
| 22 | public array $dropped, | |
| 23 | public int $outboundQueued, | |
| 24 | ) {} | |
| 25 | ||
| 26 | public function countDropped(): int | |
| 27 | { | |
| 28 | return array_sum(array_map(static fn(MqttDropCount $drops): int => $drops->count, $this->dropped)); | |
| 29 | } | |
| 30 | } |