@param int $expires

@return \chillerlan\OAuth\Core\AccessToken|\chillerlan\Settings\SettingsContainerInterface
336474
public function setExpiry(int $expires = null):AccessToken{
		$now = time();

		if($expires!== null){
			$expires =  intval($expires);
		}

		$this->expires = self::EOL_UNKNOWN;

		if($expires === 0 || $expires === self::EOL_NEVER_EXPIRES){
			$this->expires = self::EOL_NEVER_EXPIRES;
		}
		elseif($expires > $now){
			$this->expires = $expires;
		}
		elseif($expires > 0 && $expires < self::EXPIRY_MAX){
			$this->expires = $now + $expires;
		}

		return $this;
	}
1018123
public function setAccessToken($token = NULL, $expire = 0) {
    if (!empty($expire)) {
      $expire = REQUEST_TIME + $expire;
    }

    if (isset(\Drupal::request()->cookies)) {
      \Drupal::request()->cookies->set('Drupal_visitor_' . $this->accessTokenCookie, $token);
    }

    setrawcookie('Drupal.visitor.' . $this->accessTokenCookie, rawurlencode($token), $expire, '/');
  }
1181115
public function putCORSQuery($expires, $options=array())
    {
        $req = $this->putCORSRequest($options);
        return $req->query_sign($expires);
    }
400135
public function expiresIn($days = 14)
    {
        $this->expiry = Carbon::now(config('app.timezone'))->addDays($days)->endOfDay();

        return $this;
    }
766301
public function setExpire($expire)
	{
		if (null !== $expire)
		{
			$this->expire = $expire instanceof \DateTime ? $expire->getTimestamp() : (int) $expire;
		}
		else
		{
			$this->expire = $expire;
		}

		return $this;
	}
1195301
public function setMulti(array $keys, $expire = 0)
    {
        $results = array();
        foreach ($keys as $key => $value) {
            $results[$key] = $this->set($key, $value, $expire);
        }
        return $results;
    }
923031
private function expirationToDateTime($expires): DateTimeInterface
    {
        if ($expires instanceof DateTimeImmutable) {
            return $expires;
        }

        if ($expires instanceof DateInterval) {
            $expires = (new DateTime)->add($expires);
        } elseif (is_string($expires) || is_int($expires)) {
            $expires = new DateTime(is_numeric($expires) ? '@' . $expires : $expires);
        }

        if (!$expires instanceof DateTimeInterface) {
            throw new InvalidArgumentException(
                'Invalid cookie expiration time. Cannot be converted to DateTimeInterface.'
            );
        }

        return new DateTimeImmutable($expires->format(DateTime::ISO8601), $expires->getTimezone());
    }
965629
public function setExpire(\DateTime $expire = null)
    {
        $this->_expire = ($expire) ? $expire : null;

        return $this;
    }
1265771
public function presign(
        RequestInterface $request,
        CredentialsInterface $credentials,
        $expires
    ) {
        /*
         * Don't send this imcompatible header
         */
        //if (!$request->hasHeader('x-amz-content-sha256')) {
        //    $request = $request->withHeader(
        //        'X-Amz-Content-Sha256',
        //        $this->getPresignedPayload($request)
        //    );
        //}

        return parent::presign($request, $credentials, $expires);
    }
518190
public function set($key, $value, $expire = 0)
    {
        if ($this->type === 1) {
            return $this->memcache->set($key, $value, $expire);
        } else {
            return $this->memcache->set($this->conf['prefix'] . $key, json_encode($value, JSON_UNESCAPED_UNICODE), false, $expire);
        }
    }
983231
public function openCache($expire = 3600) {
        $this->allowCache = $expire !== false;
        $this->cacheLife = $expire;
        return $this;
    }
1165353
public function createToken(int $expire = 15): string
    {
        $token = uniqid(rand(), true);
        
        $saveInfos = (object) [
            'token' => $token,
            'date'  => new DateTime,
            'expire' => $expire
        ];

        $this->saveToken($saveInfos);
        return $saveInfos->token;
    }
609148
private function freezeExpiration(DateTimeInterface $expires): DateTimeImmutable
    {
        if (!$expires instanceof DateTimeImmutable) {
            $expires = new DateTimeImmutable($expires->format(DateTime::ISO8601), $expires->getTimezone());
        }

        return $expires;
    }
1224471
public function expire($expire = 3600) {
        $this->cache_expire = intval($expire);
        defined('CACHE_EXPIRE') or define('CACHE_EXPIRE', $expire);

        return $this;
    }
24642
public function cache($expires)
    {
        if ($expires === false) {
            $this->_headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
            $this->_headers['Cache-Control'] = array(
                'no-store, no-cache, must-revalidate',
                'post-check=0, pre-check=0',
                'max-age=0'
            );
            $this->_headers['Pragma'] = 'no-cache';
        } else {
            $expires = is_string($expires) ? strtotime($expires) : $expires;
            $this->_headers['Expires'] = gmdate('D, d M Y H:i:s', $expires).' GMT';
            $this->_headers['Cache-Control'] = 'max-age='.($expires - time());
        }
        return $this;
    }
48007
protected function setTimestamp($addCreated = 0, $addExpires = 0)
    {
        $timestampValue = $this->getPassword()->getTimestampValue();
        if ($addCreated && $addExpires && $timestampValue) {
            $timestamp = new Timestamp();
            $timestamp->setCreated(new Created($timestampValue));
            $timestamp->setExpires(new Expires($timestampValue, $addExpires));
            $this->security->setTimestamp($timestamp);
        }

        return $this;
    }
1187862
protected function ovh(Settings $settings)
    {
        $client = new OVHClient([
            'username'  => $settings->get('ovhUsername'),
            'password'  => $settings->get('ovhPassword'),
            'tenantId'  => $settings->get('ovhTenantId'),
            'container' => $settings->get('ovhContainer'),
            'region'    => empty($settings->get('ovhRegion')) ? 'BHS1' : $settings->get('ovhRegion'),
        ]);

        return new Adapters\OVH(
            new OVHAdapter($client->getContainer())
        );
    }