src/Http/Request.php
public function applyCookies($cookies)
    {
        $values = [];
        foreach ($cookies as $cookie) {
            if ($cookie->matches($this->url())) {
                $values[$cookie->path()] = $cookie->name() . '=' . $cookie->value();
            }
        }

        $keys = array_map('strlen', array_keys($values));
        array_multisort($keys, SORT_DESC, $values);
        $headers = $this->headers();
        if ($values) {
            $headers['Cookie'] = implode('; ', $values);
        } else {
            unset($headers['Cookie']);
        }
        return $this;
    }
public function applyCookies($cookies)
    {
        $values = [];
        foreach ($cookies as $cookie) {
            if ($cookie->matches($this->url())) {
                $values[$cookie->path()] = $cookie->name() . '=' . $cookie->value();
            }
        }

        $keys = array_map('strlen', array_keys($values));
        array_multisort($keys, SORT_DESC, $values);
        $headers = $this->headers();
        if ($values) {
            $headers['Cookie'] = implode('; ', $values);
        } else {
            unset($headers['Cookie']);
        }
        return $this;
    }
public function applyCookies ( $ cookies ) { $ values = [ ] ; foreach ( $ cookies as $ cookie ) { if ( $ cookie -> matches ( $ this -> url ( ) ) ) { $ values [ $ cookie -> path ( ) ] = $ cookie -> name ( ) . '=' . $ cookie -> value ( ) ; } } $ keys = array_map ( 'strlen' , array_keys ( $ values ) ) ; array_multisort ( $ keys , SORT_DESC , $ values ) ; $ headers = $ this -> headers ( ) ; if ( $ values ) { $ headers [ 'Cookie' ] = implode ( '; ' , $ values ) ; } else { unset ( $ headers [ 'Cookie' ] ) ; } return $ this ; }
Set the Cookie header

@param  array $cookies The cookies.
@return self
Set the Cookie header