Convert to `Set-Cookie` headers

@return string[]
558282
public function toHeaders()
    {
        $headers = [];
        foreach ($this->responseCookies as $name => $properties) {
            $headers[] = $this->toHeader($name, $properties);
        }
        return $headers;
    }
855686
protected function getRequestCookies()
    {
        $pairs = array();

        foreach ($this->cookies as $k => $v) {
            $pairs[] = "$k=$v";
        }

        return join($pairs, ';');
    }
704656
private function sendHeaders() {
        if (!headers_sent()) {
            http_response_code($this->statusCode);
            foreach ($this->headers as $header) {
                header($header);
            }
            foreach ($this->cookies as $cookie) {
                call_user_func_array("setcookie", $cookie);
            }
        }
    }
1213441
protected function getHeaders()
    {
        return [
            'X-RateLimit-Limit' => $this->handler->getThrottleLimit(),
            'X-RateLimit-Remaining' => $this->handler->getRemainingLimit(),
            'X-RateLimit-Reset' => $this->handler->getRateLimitReset(),
        ];
    }
729455
protected function getCookies() {
    $current_request = $this->requestStack->getCurrentRequest();
    if (isset($current_request->cookies)) {
      return $current_request->cookies->all();
    }
    return $_COOKIE;
  }
1095777
public function getCookieParams() : array
    {
        $r = [];
        foreach ($this->cookies->toArray(false) as $k => $v) {
            $r[$k] = $v->getValue();
        }
        return $r;
    }
1012594
private function compileHeaders(): array
    {
        return array_merge(
            $this->security['settings']['enable-hsts'] ? $this->hsts() : [],
            $this->security['settings']['enable-hpkp'] ? $this->hpkp() : [],
            $this->security['settings']['enable-ect'] ? $this->ect() : [],
            $this->security['settings']['enable-extras'] ? $this->extras() : []
        );
    }
756253
protected function parseIncomingCookies($headers)
    {
        $this->incomingTrackerCookies = array();
        
        if (!empty($headers)) {
            $headerName = 'set-cookie:';
            $headerNameLength = strlen($headerName);
            
            foreach($headers as $header) {
                if (strpos(strtolower($header), $headerName) !== 0) {
                    continue;
                }
                $cookies = trim(substr($header, $headerNameLength));
                $posEnd = strpos($cookies, ';');
                if ($posEnd !== false) {
                    $cookies = substr($cookies, 0, $posEnd);
                }
                parse_str($cookies, $this->incomingTrackerCookies);
            }
        }   
    }
576035
protected function getAdminFromCookie()
    {
        $auth_cookie = Request::getInstance()->getCookie($this->getHash());
        $user = $pass = array();
        if (!empty($auth_cookie)) {
            list($user, $pass) = explode(':', base64_decode($auth_cookie));
        }

        return array($user, $pass);
    }
554660
private function setHeadersFromCookies()
    {
        $values = [];

        foreach ($this->cookies as $cookie) {
            $values[] = (string) $cookie;
        }

        $this->setHeader("cookie", $values);
    }
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;
            }
        }
    }
281261
protected function _getCookies()
    {
        $this->buildCookieCollection();

        $cookies = [];
        foreach ($this->cookies as $cookie) {
            $cookies[$cookie->getName()] = $this->convertCookieToArray($cookie);
        }

        return $cookies;
    }
1213146
public function toHeaderLine() : string
  {
    $cookie = sprintf('%s=%s', $this->name, urlencode($this->value));
    
    if ($this->expires !== 0) {
      $cookie .= sprintf('; expires=%s', gmdate('D, d-M-Y H:i:s T', $this->expires));
    }

    if (!empty($this->path)) {
      $cookie .= sprintf('; path=%s', $this->path);
    }

    if (!empty($this->domain)) {
      $cookie .= sprintf('; domain=%s', $this->domain);
    }

    if (!empty($this->secure)) {
      $cookie .= '; secure';
    }

    if (!empty($this->httpOnly)) {
      $cookie .= '; httponly';
    }

    return $cookie;
  }
586802
public function getCookies()
    {
        $cookieArrays = $this->executor->execute(DriverCommand::GET_ALL_COOKIES);
        $cookies = [];

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

        return $cookies;
    }
1102402
private static function getCookies($headers)
    {
        $cookiesRaw = isset($headers['Set-Cookie'])
            ? (array) $headers['Set-Cookie']
            : array();
        $cookies = array();
        foreach ($cookiesRaw as $header) {
            $pairs = \explode(';', $header);
            $pair = \explode('=', $pairs[0]);
            $key = \array_shift($pair);
            $value = \array_shift($pair);
            $cookies[\urldecode($key)] = \urldecode($value);
        }
        return $cookies;
    }
402063
protected static function buildCookieHeader($cookies)
    {
        $headers = [];
        foreach ($cookies as $cookie) {
            $parts = [
                sprintf('%s=%s', urlencode($cookie['name']), urlencode($cookie['value']))
            ];
            if ($cookie['expire']) {
                $cookie['expire'] = gmdate('D, d M Y H:i:s T', $cookie['expire']);
            }
            $attributes = [
                'expire' => 'Expires=%s',
                'path' => 'Path=%s',
                'domain' => 'Domain=%s',
                'httpOnly' => 'HttpOnly',
                'secure' => 'Secure',
            ];
            foreach ($attributes as $key => $attr) {
                if ($cookie[$key]) {
                    $parts[] = sprintf($attr, $cookie[$key]);
                }
            }
            $headers[] = implode('; ', $parts);
        }

        return $headers;
    }
467457
public final function getCookies() : array
   {

      if ( ! $this->getCookieFile() )
      {
         return [];
      }

      unset( $this->_curlHandle );

      $text = \file_get_contents( $this->getCookieFile() );

      $cookies = [];
      foreach ( \explode( "\n", $text ) as $line )
      {
         $parts = explode( "\t", $line );
         if ( 7 === \count( $parts ) )
         {
            $cookies[ $parts[ 5 ] ] = $parts[ 6 ];
         }
      }

      return $cookies;

   }