protected function createCookie(array $config, SessionInterface $session)
    {
        $expireOnClose = Arr::get($config, 'expireOnClose', false);

        if ($expireOnClose !== false) {
            $lifetime = Arr::get($config, 'lifetime', 180);

            $expire = Carbon::now()->addMinutes($lifetime);
        } else {
            $expire = 0;
        }

        $secure = Arr::get($config, 'secure', false);

        return new Cookie(
            $session->getName(),
            $session->getId(),
            $expire,
            $config['path'],
            $config['domain'],
            $secure
        );
    }