protected function extractCookiesArgument(RequestInterface $request, array $options)
{
if (!isset($options['cookies']) || !$options['cookies'] instanceof CookieJarInterface) {
return;
}
$values = [];
$scheme = $request->getUri()->getScheme();
$host = $request->getUri()->getHost();
$path = $request->getUri()->getPath();
/** @var SetCookie $cookie */
foreach ($options['cookies'] as $cookie) {
if ($cookie->matchesPath($path) && $cookie->matchesDomain($host) && !$cookie->isExpired() && (!$cookie->getSecure() || $scheme == 'https')) {
$values[] = $cookie->getName() . '=' . $cookie->getValue();
}
}
if ($values) {
$this->addOption('b', escapeshellarg(implode('; ', $values)));
}
}