protected function getTimestamp($expiration): ?string
    {
        if (\is_int($expiration) && \mb_strlen((string) $expiration) === 10 && $this->isValidTimeStamp($expiration)) {
            return Chronos::createFromTimestamp($expiration)->toCookieString();
        }

        if (\is_int($expiration)) {
            return Chronos::now()->addSeconds($expiration)->toCookieString();
        }

        if ($expiration instanceof DateTimeInterface) {
            return $expiration->format(DateTime::COOKIE);
        }

        if (\is_string($expiration)) {
            return $expiration;
        }

        return null;
    }