setTimestamp( $now->getTimestamp() - self::MAX_AGE_SECONDS ); } /** * Apply the same confirmation and freshness rules before repository limits. * * @param AmazonDiscountProduct $product Stored snapshot. * @param DateTimeImmutable $now Current instant. */ public static function allows( AmazonDiscountProduct $product, DateTimeImmutable $now ): bool { $saving = $product->savingsPercentage(); return $saving !== null && $saving >= max( AmazonDiscountSyncService::DEFAULT_MIN_SAVING_PERCENT, $product->minSavingPercent() ) && $saving <= 100 && $product->fetchedAt() > self::cutoff( $now ) && $product->fetchedAt() <= $now; } }