Set expires

@param  \DateTime   $expires
@return AccessToken
978956
public function setExpires($expires)
    {
        if (!$expires instanceof \DateTime) {
            // @see https://github.com/bshaffer/oauth2-server-bundle/issues/24
            $dateTime = new \DateTime();
            $dateTime->setTimestamp($expires);
            $expires = $dateTime;
        }

        $this->expires = $expires;

        return $this;
    }
667163
public function setExpire($expire)
    {
        if (!$expire instanceof DateTime) {
            if (is_integer($expire)) {
                $expire = (new DateTime())->setTimestamp($expire);
            } else {
                $expire = new DateTime($expire);
            }
        }
        $this->expire = $expire;

        return $this;
    }
313601
public function set($key, $value, $expire = 0)
    {
        ($expire == 0) && $expire = null;
        return apc_store($this->conf['prefix'] . $key, $value, $expire);
    }
833157
public function set($key, $value, int $expire = 30) : Cookies
    {
        setcookie($key, $value, time() + $expire);

        return $this;
    }
346317
public function setExpires($timestamp)
    {
        $this->data['Expires'] = is_numeric($timestamp)
            ? (int) $timestamp
            : strtotime($timestamp);

        return $this;
    }
200100
public function cleanUp( $expires = 0 )
	{
		$expires	= $expires ? $expires : $this->expires;
		if( !$expires )
			throw new InvalidArgumentException( 'No expire time given or set on construction.' );

		$number	= 0;
		$index	= new DirectoryIterator( $this->path );
		foreach( $index as $entry )
		{
			if( $entry->isDot() || $entry->isDir() )
				continue;
			$pathName	= $entry->getPathname();
			if( substr( $pathName, -7 ) !== ".serial" )
				continue;
			if( $this->isExpired( $pathName, $expires ) )
				$number	+= (int) @unlink( $pathName );
		}
		return $number;
	}
323274
public function setAccessTokenExpire($access_token_expire)
    {
        //Store expiry date as unix timestamp (now + expires in)
        $access_token_expire = time() + $access_token_expire;
        $this->access_token_expire = $access_token_expire;
        $config = SiteConfig::current_site_config();
        $config->HailAccessTokenExpire = $access_token_expire;
        $config->write();
    }
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, '/');
  }
927450
protected function getExpireTime($expire)
    {
        if ($expire instanceof \DateTime) {
            $expire = $expire->getTimestamp() - time();
        }

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

        return $expires;
    }
1371909
public function set($name, $value, $expires = null)
    {
        $name = $this->getFullName($name);

        if (!is_array($value)) {
            $value = ['value' => (string) $value];
        }

        if (isset($expires)) {
            $value['expires'] = $expires;
        }

        parent::set($name, $value);

        return $this;
    }
870140
public function setExpires($date): void
    {
        if ($date instanceof \DateTime) {
            $date = clone $date;
        } else {
            $date = new \DateTime($date);
        }

        $date->setTimezone(new \DateTimeZone('UTC'));
        $this->response->setHeader('Expires', $date->format('D, d M Y H:i:s') . ' GMT');
    }
969261
public static function cacheHeaders($expires = '+1 hour')
    {
        if (!headers_sent()) {
            header('Cache-Control: private, max-age=3600');
            header('Pragma: public');
            header('Last-Modified: ' . date(DATE_RFC822, strtotime('-1 second')));
            header('Expires: ' . date(DATE_RFC822, strtotime($expires)));
        }
    }
743189
public function setExpiryDate($expirydate='')
    {
        if ( !$this->isExpiryDate($expirydate) ) {
            throw new TpvException('Expire date is not valid');
        }
        $this->_setParameters['DS_MERCHANT_EXPIRYDATE'] = $expirydate;
        return $this;

    }
1269041
public function setExpiresOn($date)
    {
        $date = AnDomainAttributeDate::getInstance()->setDate($date);
        $this->set('expiresOn', $date);
    }
554999
public function setExpired($expired)
    {
        if ($expired instanceof DateTime) {
            $this->expired = $expired;
            return;
        } elseif ($expired instanceof Model) {
            $this->expired = $expired->deleted_at ?: $expired->updated_at;
            return;
        }

        $this->expired = new DateTime($expired);
    }
1190644
public function expire($expire)
    {
        if (is_null($expire)) {
            $this->expire = null;
        } elseif (is_numeric($expire) || $expire instanceof DateInterval) {
            $this->expiresAfter($expire);
        } elseif ($expire instanceof DateTimeInterface) {
            $this->expire = $expire;
        } else {
            throw new InvalidArgumentException('not support datetime');
        }

        return $this;
    }