RetentionSettings
Corex\Config\Retention\RetentionSettings · class · Config layer
Pure rules for submission data retention (spec 065). A retention window of 0 means “keep forever” (retention disabled); any positive number of days enables pruning of submissions older than that. This model owns only the safe, testable decisions — the sanitised window, whether retention is enabled, and the shape of the dry-run preview. It never deletes anything; the boundary does, and only after an explicit preview + confirmation. WordPress-free, so it is unit-testable.
Public API
Section titled “Public API”sanitizeDays(mixed $value): int
Section titled “sanitizeDays(mixed $value): int”Clamp an arbitrary input to a valid retention window in days (0 = keep forever).
isEnabled(int $days): bool
Section titled “isEnabled(int $days): bool”isAction(string $action): bool
Section titled “isAction(string $action): bool”Whether this is a retention action: archive, trash or anonymize.
assertAction(string $action): void
Section titled “assertAction(string $action): void”statesToSkip(string $action): array
Section titled “statesToSkip(string $action): array”The retention states an action has nothing left to do for, so a run of it skips records in them. Without this a run is handed the records the previous run already handled, and — a run being bounded by {@see self::MAX_PRUNE} — never reaches the ones behind them.
preview(int $days, int $count): array
Section titled “preview(int $days, int $count): array”The dry-run preview model: the window, whether retention is on, and how many submissions are due right now (the count the boundary measured). Never a fabricated number.