public static function parseMediaType(string $rawMediaType): array
    {
        preg_match(self::PATTERN_SPLITMEDIATYPE, $rawMediaType, $matches);
        $result = [];
        $result['type'] = $matches['type'] ?? '';
        $result['subtype'] = $matches['subtype'] ?? '';
        $result['parameters'] = [];

        if (isset($matches['parameters'])) {
            foreach (Arrays::trimExplode(';', $matches['parameters']) as $parameter) {
                $pieces = explode('=', $parameter);
                if (count($pieces) === 2) {
                    $name = trim($pieces[0]);
                    $result['parameters'][$name] = trim($pieces[1]);
                }
            }
        }
        return $result;
    }