public static function parseContentType(string $content_type)
    {
        $directives = array_map('trim', explode(';', $content_type));

        $result = [
            'mime' => array_shift($directives)
        ];

        if (empty($directives)) {
            return $result['mime'];
        }

        foreach ($directives as $directive) {
            $parts = explode('=', $directive);
            $result[$parts[0]] = $parts[1];
        }

        return $result;
    }