retentionDays = $retentionDays; } /** * Default retention policy. */ public static function default(): self { return new self( self::DEFAULT_RETENTION_DAYS ); } /** * Retention window in days. */ public function retentionDays(): int { return $this->retentionDays; } /** * Compute retention cutoff. * * @param DateTimeImmutable $now Current time. */ public function cutoffFrom( DateTimeImmutable $now ): DateTimeImmutable { return $now->setTimezone( new DateTimeZone( 'UTC' ) ) ->sub( new DateInterval( 'P' . $this->retentionDays . 'D' ) ); } }