Files
guides/projects/priceservice/vendor/symfony/rate-limiter/Util/TimeUtil.php
2026-06-03 22:05:20 +02:00

28 lines
614 B
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\RateLimiter\Util;
/**
* @author Wouter de Jong <wouter@wouterj.nl>
*
* @internal
*/
final class TimeUtil
{
public static function dateIntervalToSeconds(\DateInterval $interval): int
{
$now = \DateTimeImmutable::createFromFormat('U', time());
return $now->add($interval)->getTimestamp() - $now->getTimestamp();
}
}