src/Http/RequestFactory.php
protected function createHeadersFromSuperglobals(array $server): HttpHeaders
    {
        $headers = new HttpHeaders();

        foreach ($server as $name => $values) {
            // If this header supports multiple values and has unquoted string delimiters...
            $containsMultipleValues = isset(self::$headersThatPermitMultipleValues[$name])
                && count($explodedValues = preg_split('/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/', $values)) > 1;

            if ($containsMultipleValues) {
                foreach ($explodedValues as $value) {
                    $this->addHeaderValue($headers, $name, $value, true);
                }
            } else {
                $this->addHeaderValue($headers, $name, $values, false);
            }
        }

        return $headers;
    }
protected function createHeadersFromSuperglobals(array $server): HttpHeaders
    {
        $headers = new HttpHeaders();

        foreach ($server as $name => $values) {
            // If this header supports multiple values and has unquoted string delimiters...
            $containsMultipleValues = isset(self::$headersThatPermitMultipleValues[$name])
                && count($explodedValues = preg_split('/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/', $values)) > 1;

            if ($containsMultipleValues) {
                foreach ($explodedValues as $value) {
                    $this->addHeaderValue($headers, $name, $value, true);
                }
            } else {
                $this->addHeaderValue($headers, $name, $values, false);
            }
        }

        return $headers;
    }
Creates headers from PHP globals

@param array $server The global server array
@return HttpHeaders The request headers
@throws InvalidArgumentException Thrown if any of the headers were in an invalid format
@throws RuntimeException Thrown if any of the headers' hash keys could not be calculated