src/Http/Formatting/HttpHeaderParser.php
public function parseParameters(HttpHeaders $headers, string $headerName, int $index = 0): IImmutableDictionary
    {
        $headerValues = [];

        if (!$headers->tryGet($headerName, $headerValues) || !isset($headerValues[$index])) {
            return new ImmutableHashTable([]);
        }

        $kvps = [];

        foreach (preg_split(self::PARAMETER_SPLIT_REGEX, $headerValues[$index]) as $kvp) {
            $matches = [];

            // Split the parameters into names and values
            if (preg_match_all(self::PARAMETER_KEY_VALUE_REGEX, $kvp, $matches)) {
                $key = trim($matches[0][0], self::PARAMETER_TRIMMED_CHARS);
                $value = isset($matches[0][1]) ? trim($matches[0][1], self::PARAMETER_TRIMMED_CHARS) : null;
                $kvps[] = new KeyValuePair($key, $value);
            }
        }

        return new ImmutableHashTable($kvps);
    }
public function parseParameters(HttpHeaders $headers, string $headerName, int $index = 0): IImmutableDictionary
    {
        $headerValues = [];

        if (!$headers->tryGet($headerName, $headerValues) || !isset($headerValues[$index])) {
            return new ImmutableHashTable([]);
        }

        $kvps = [];

        foreach (preg_split(self::PARAMETER_SPLIT_REGEX, $headerValues[$index]) as $kvp) {
            $matches = [];

            // Split the parameters into names and values
            if (preg_match_all(self::PARAMETER_KEY_VALUE_REGEX, $kvp, $matches)) {
                $key = trim($matches[0][0], self::PARAMETER_TRIMMED_CHARS);
                $value = isset($matches[0][1]) ? trim($matches[0][1], self::PARAMETER_TRIMMED_CHARS) : null;
                $kvps[] = new KeyValuePair($key, $value);
            }
        }

        return new ImmutableHashTable($kvps);
    }
Parses the parameters (semi-colon delimited values for a header) for the first value of a header

@param HttpHeaders $headers The headers to parse
@param string $headerName The name of the header whose parameters we're parsing
@param int $index The index of the header value to parse
@return IImmutableDictionary The dictionary of parameters for the first value