final class FrwState{ private function __construct( private readonly ?\DateTimeImmutable
$completedAt = null,
private readonly ?\DateTimeImmutable
$failedAt = null,
private readonly int
$failureCount = 0
) { } public static function openState(): FrwState
{ return new FrwState();
} public static function completedState(?\DateTimeImmutable
$completedAt = null
): FrwState
{ return new FrwState($completedAt ??
new \
DateTimeImmutable());
} public static function failedState(?\DateTimeImmutable
$failedAt = null, int
$failureCount = 0
): FrwState
{ return new FrwState(null,
$failedAt ??
new \
DateTimeImmutable(),
$failureCount);
}