private function parseHeaderParameters(string $header) : array
    {
        $result = [];
        $values = explode(',', $header);

        foreach ($values as $parts) {
            $parameters = [];
            $parts = explode(';', $parts);
            $item = trim(array_shift($parts));

            if ($item === '') {
                continue;
            }

            foreach ($parts as $part) {
                if (preg_match('/^\s*([^\=]+)\=(.*?)\s*$/', $part, $matches) === 0) {
                    continue;
                }

                $parameters[$matches[1]] = $matches[2];
            }

            $result[$item] = $parameters;
        }

        return $result;
    }