Lines
100.00%
4 / 4
Methods
100.00%
4 / 4
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| hasCurrentFormat | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| hasDrift | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 2 | ||
| hasSameDriftAs | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 2 | ||
| 10 | final readonly class GeneratedCodeStatus | |
| 11 | { | |
| 12 | /** | |
| 13 | * @param list<string> $added | |
| 14 | * @param list<string> $removed | |
| 15 | */ | |
| 16 | public function __construct( | |
| 17 | public int $format, | |
| 18 | public int $expectedFormat, | |
| 19 | #[ListOf('string')] | |
| 20 | public array $added, | |
| 21 | #[ListOf('string')] | |
| 22 | public array $removed, | |
| 23 | public Instant $checkedAt, | |
| 24 | ) {} | |
| 25 | ||
| 26 | public function hasCurrentFormat(): bool | |
| 27 | { | |
| 28 | return $this->format === $this->expectedFormat; | |
| 29 | } | |
| 30 | ||
| 31 | public function hasDrift(): bool | |
| 32 | { | |
| 33 | return $this->added !== [] || $this->removed !== []; | |
| 34 | } | |
| 35 | ||
| 36 | public function hasSameDriftAs(self $other): bool | |
| 37 | { | |
| 38 | return $this->added === $other->added && $this->removed === $other->removed; | |
| 39 | } | |
| 40 | } |