public function setDefaultSeconds($ttl): void
    {
        $type = gettype($ttl);
        switch ($type) {
            case "integer":
                $seconds = $ttl;
                break;
            case "object":
                if ($ttl instanceof \DateInterval) {
                    $seconds = $this->dateIntervalToSeconds($ttl);
                } else {
                    throw StrictTypeException::defaultTTL($ttl);
                }
                break;
            default:
                if (! $this->strictType) {
                    if (is_numeric($ttl)) {
                        $seconds = intval($ttl);
                    }
                }
        }
        if (! isset($seconds)) {
            throw StrictTypeException::defaultTTL($ttl);
        }
        if ($seconds < 0) {
            throw InvalidArgumentException::negativeDefaultTTL($seconds);
        }
        $this->defaultSeconds = $seconds;
    }
public function setDefaultSeconds($ttl): void
    {
        $type = gettype($ttl);
        switch ($type) {
            case "integer":
                $seconds = $ttl;
                break;
            case "object":
                if ($ttl instanceof \DateInterval) {
                    $seconds = $this->dateIntervalToSeconds($ttl);
                } else {
                    throw StrictTypeException::defaultTTL($ttl);
                }
                break;
            default:
                if (! $this->strictType) {
                    if (is_numeric($ttl)) {
                        $seconds = intval($ttl);
                    }
                }
        }
        if (! isset($seconds)) {
            throw StrictTypeException::defaultTTL($ttl);
        }
        if ($seconds < 0) {
            throw InvalidArgumentException::negativeDefaultTTL($seconds);
        }
        $this->defaultSeconds = $seconds;
    }
public function setDefaultSeconds ( $ ttl ) : void { $ type = gettype ( $ ttl ) ; switch ( $ type ) { case "integer" : $ seconds = $ ttl ; break ; case "object" : if ( $ ttl instanceof \ DateInterval ) { $ seconds = $ this -> dateIntervalToSeconds ( $ ttl ) ; } else { throw StrictTypeException :: defaultTTL ( $ ttl ) ; } break ; default : if ( ! $ this -> strictType ) { if ( is_numeric ( $ ttl ) ) { $ seconds = intval ( $ ttl ) ; } } } if ( ! isset ( $ seconds ) ) { throw StrictTypeException :: defaultTTL ( $ ttl ) ; } if ( $ seconds < 0 ) { throw InvalidArgumentException :: negativeDefaultTTL ( $ seconds ) ; } $ this -> defaultSeconds = $ seconds ; }
Sets the default cache TTL in seconds.

@param int|\DateInterval $ttl The default TTL to cache entries.

@throws StrictTypeException
@throws InvalidArgumentException

@psalm-suppress RedundantConditionGivenDocblockType
@psalm-suppress RedundantCondition

@return void
Sets the default cache TTL in seconds .