StreamClient::setCookiesFromArray()

@return
345241
public  function setCookiesFromArray(array $cookies)
    {
        $cookieJar = new GuzzleCookieJar();
        foreach($cookies as $name => $value) {
            $cookieJar->setCookie(new \GuzzleHttp\Cookie\SetCookie([
                'Domain'    => $value['domain'],
                'Name'      => $value['name'],
                'Value'     => $value['value'],
                'Path'      => $value['path'],
                'Expires'   => $value['expiry'],
                'Secure'    => $value['secure'],
                'HttpOnly'  => $value['httpOnly'],
            ]));
        }
        $this->defaultOptions['cookies'] = $cookieJar;
        return $this->initClient();
    }
203985
public function withCookies(array $cookies)
    {
        foreach ($cookies as $cookie) {
            $this->headers->setCookie($cookie);
        }

        return $this;
    }
1007510
protected function parseCookies(): array
    {
        # cookies are encoded in the `cookie` header
        $header = $this->getHeader("cookie");
        if (empty($header)) {
            return [];
        }

        # create a data collection to gracefully handle arrays
        $options = $this->getDecoderOptions();
        $collection = new \sndsgd\http\data\Collection(
            $options->getMaxVars(),
            $options->getMaxNestingLevels()
        );

        foreach (explode(";", $header) as $cookie) {
            $cookie = trim($cookie);
            if ($cookie === "") {
                continue;
            }

            $pair = explode("=", $cookie, 2);
            if (!isset($pair[1]) || $pair[1] === "") {
                continue;
            }

            list($key, $value) = $pair;
            $collection->addValue(urldecode($key), urldecode($value));
        }

        return $collection->getValues();
    }
586615
private function setCookiesFromHeaders()
    {
        $this->cookies = [];

        $headers = $this->getHeaderAsArray('Cookie');

        foreach ($headers as $line) {
            foreach (explode(';', $line) as $pair) {
                $cookie = BasicCookie::fromHeader($pair);
                $this->cookies[$cookie->getName()] = $cookie;
            }
        }
    }
586802
public function getCookies()
    {
        $cookieArrays = $this->executor->execute(DriverCommand::GET_ALL_COOKIES);
        $cookies = [];

        foreach ($cookieArrays as $cookieArray) {
            $cookies[] = Cookie::createFromArray($cookieArray);
        }

        return $cookies;
    }
120468
public function setFromArray(array $data)
    {
        $data = array_intersect_key($data, $this->_data);

        foreach ($data as $columnName => $value) {
            $this->__set($columnName, $value);
        }

        return $this;
    }
170691
public function putCookie(array $cookieValues): self
    {
        $cookieValue = '';
        foreach ($cookieValues as $key => $value) {
            $cookieValue .= $key . '=' . urlencode($value) . ';';
        }

        $this->put('Cookie', $cookieValue);
        return $this;
    }
104268
@Override
    public boolean set(HttpCookie cookie, byte[] attribValue) {
        try {
            if (null != cookie && null != attribValue && 0 < attribValue.length) {
                cookie.setVersion(GenericUtils.asIntValue(attribValue));
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Cookie version set to " + cookie.getVersion());
                }
                return true;
            }
        } catch (Exception e) {
            FFDCFilter.processException(e, getClass().getName(), "set", this);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Exception setting version; " + e);
            }
        }
        return false;
    }
887436
public function cookies(array $cookies = null): HttpRequest
    {
        if ($cookies === null) {
            $cookies = $_COOKIE;
        }
        foreach ($cookies as $name => $value) {
            $this->cookie($name, $value);
        }

        return $this;
    }
300583
public function cookie(array $cookie) {

        $cookies = '';

        foreach($cookie as $k => $v)

            $cookies .= $k . '=' . $v . ';';

        curl_setopt(self::$handle, CURLOPT_COOKIE, $cookies);

        return $this;
    }
848071
public function applyCookies($cookies)
    {
        $headers = $this->headers();

        foreach ($cookies as $cookie) {
            $headers['Set-Cookie'][] = $cookie->toString();
        }
        return $this;
    }
920904
Cookie[] convertCookies(HttpEntity<?> httpEntity) {
        final List<Cookie> cookies = new LinkedList<>();

        List<String> inboundCookies = httpEntity.getHeaders().get(HttpHeaders.SET_COOKIE);
        if (inboundCookies != null) {
            for (String cookieString : inboundCookies) {
                Cookie cookie = convertCookieString(cookieString);
                cookies.add(cookie);
            }
        }

        return cookies.toArray(new Cookie[0]);
    }
992245
protected function sendCookies()
    {
        $cookies = $this->getCookies();

        foreach ($cookies as $name => $cookie) {
            setcookie($name, $cookie['value'], (int)$cookie['expire'],
                $cookie['path']);
        }

        return $this;
    }
156097
public HttpRequest cookie(HttpCookie... cookies) {
		if (ArrayUtil.isEmpty(cookies)) {
			return disableCookie();
		}
		return cookie(ArrayUtil.join(cookies, ";"));
	}
961252
private function setCookieJar()
    {
        switch($this->options['cookie_type']){
            case 'array':
                $this->cookiejar = new CookieJar();
                break;
            case 'file':
                $this->cookiejar = new FileCookieJar($this->options['cookie_file_name']);
                break;
            case 'session':
                $this->cookiejar = new SessionCookieJar($this->options['cookie_session_key']);
                break;
            default:
                throw new YouHostingException("You didn't specify a valid cookie type!");
        }
    }
50192
private static function parseCookies(array $cookiesArray): RequestCookieCollectionInterface
    {
        $cookies = new RequestCookieCollection();

        foreach ($cookiesArray as $cookieName => $cookieValue) {
            $cookies->set(
                strval($cookieName),
                new RequestCookie(strval($cookieValue))
            );
        }

        return $cookies;
    }
479783
public function setFromArray(array $values) {
        foreach ($values as $key => $val) {
            $this->set($key, $val);
        }
        return $this;
    }