private function normalizeTtl($ttl)
    {
        if ($ttl === null) {
            return self::DEFAULT_TTL; // Default TTL is one hour
        }

        if (\is_int($ttl)) {
            return $ttl;
        }

        if ($ttl instanceof DateInterval) {
            $currentDateTime = new \DateTimeImmutable();
            $ttlDateTime = $currentDateTime->add($ttl);

            return $ttlDateTime->getTimestamp() - $currentDateTime->getTimestamp();
        }

        throw new InvalidArgumentException('Invalid TTL: ' . print_r($ttl, true));
    }
private function normalizeTtl($ttl)
    {
        if ($ttl === null) {
            return self::DEFAULT_TTL; // Default TTL is one hour
        }

        if (\is_int($ttl)) {
            return $ttl;
        }

        if ($ttl instanceof DateInterval) {
            $currentDateTime = new \DateTimeImmutable();
            $ttlDateTime = $currentDateTime->add($ttl);

            return $ttlDateTime->getTimestamp() - $currentDateTime->getTimestamp();
        }

        throw new InvalidArgumentException('Invalid TTL: ' . print_r($ttl, true));
    }
private function normalizeTtl ( $ ttl ) { if ( $ ttl === null ) { return self :: DEFAULT_TTL ; // Default TTL is one hour } if ( \ is_int ( $ ttl ) ) { return $ ttl ; } if ( $ ttl instanceof DateInterval ) { $ currentDateTime = new \ DateTimeImmutable ( ) ; $ ttlDateTime = $ currentDateTime -> add ( $ ttl ) ; return $ ttlDateTime -> getTimestamp ( ) - $ currentDateTime -> getTimestamp ( ) ; } throw new InvalidArgumentException ( 'Invalid TTL: ' . print_r ( $ ttl , true ) ) ; }
Convert TTL to seconds

@param int|DateInterval|null $ttl

@return int
@throws \PageCache\Storage\InvalidArgumentException
Convert TTL to seconds