Sets the cookie's expire time

The time should be an integer
representing a Unix timestamp

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

		return $this;
	}
1031184
public function setCookie(string $key, string $value = '', int $expire = 0, string $path = '/', string $domain = '', bool $secure = false, bool $httponly = false)
    {
        if (!$this->controller->canEnd()) {
            return;
        }
        $this->response->cookie($key, $value, $expire, $path, $domain, $secure, $httponly);
    }
1049324
public function set(string $key, $value, int $expire = null): bool {
		if ($value instanceof Closure) {
			$value = $value();
		}
		return $this->driver->set($key, static::serialize($value), $expire ?? $this->expire);
	}
538591
public function set($key, $value, $expire = 0)
    {
        return $this->setItem($key, $value, time(), $expire);
    }
609148
private function freezeExpiration(DateTimeInterface $expires): DateTimeImmutable
    {
        if (!$expires instanceof DateTimeImmutable) {
            $expires = new DateTimeImmutable($expires->format(DateTime::ISO8601), $expires->getTimezone());
        }

        return $expires;
    }
1180711
function setExpiresIn($expiry)
    {
        $this->expiresIn = $expiry;
        $this->datetimeExpiration = $this->getDateTimeExpiration();
        return $this;
    }
642313
private function normalizeExpiration($expires)
    {
        if ($expires instanceof Timestamp) {
            $seconds = $expires->get()->format('U');
        } elseif ($expires instanceof \DateTimeInterface) {
            $seconds = $expires->format('U');
        } elseif (is_numeric($expires)) {
            $seconds = (int) $expires;
        } else {
            throw new \InvalidArgumentException('Invalid expiration.');
        }

        return $seconds;
    }
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');
    }
972186
public function addCookie(string $key, $value, \DateTimeInterface $expire)
    {
        $this->cookies[$key] = $this->cookieFactory->build($key, $value, $expire);
    }
983231
public function openCache($expire = 3600) {
        $this->allowCache = $expire !== false;
        $this->cacheLife = $expire;
        return $this;
    }
1132213
public function cacheUntil($expires)
    {
        if (!is_int($expires)) {
            $expires = strtotime($expires);
        }
        return $this
            ->withHeader('Pragma', 'public')
            ->withHeader('Cache-Control', 'maxage='.($expires - time()))
            ->withHeader('Expires', gmdate('D, d M Y H:i:s', $expires).' 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)));
        }
    }
400386
public function set($key, $value, $expire = 0)
    {
        if ($this->expire) {
            $expire = $this->expire;
        }

        return $this->handle->set($key, $value, $expire);
    }
1009054
public function setToken($token, $expires = 7200)
    {
        Yii::$app->wechat->cache->set([__CLASS__, 'appId' => Yii::$app->wechat->appId], $token, $expires - 1500);
        return $this;
    }
1305835
public function setExpirationDate($expirationDate, $format = '')
    {
        try {
            if (is_string($expirationDate) && $format) {
                $date = \DateTime::createFromFormat($format, $expirationDate);
            } else if (is_string($expirationDate) && !$format) {
                $date = new \DateTime($expirationDate);
            } else {
                $date = $expirationDate;
            }
        } catch (\Exception $e) {
            throw new InvalidExpirationDateException($e->getMessage(), $e->getCode(), $e);
        }

        if (null !== $date && !($date instanceof \DateTime)) {
            throw new InvalidExpirationDateException();
        }

        $this->expirationDate = $date;

        return $this;
    }
773045
public function set($value,  int $expire = 0): bool
    {
        return parent::setString(json($value),  $expire);
    }
797121
public function expire($expire = 0)
    {
        $var = null;
        $var = substr($expire, 0, 1);

        if (in_array($var, ['+', '-'])) {
            $this->expire = strtotime($expire);

            if ($this->expire === false) {
                throw new \InvalidCookieException(
                    'Cookie->setExpire was passed a string it could not parse - "'.$expire.'"'
                );
            }

            return $this;
        }

        $this->expire = 0;

        return $this;
    }