protected function convertMediaType($requestBody, $mediaType)
    {
        $mediaTypeParts = MediaTypes::parseMediaType($mediaType);
        if (!isset($mediaTypeParts['subtype']) || $mediaTypeParts['subtype'] === '') {
            return [];
        }
        $result = [];
        switch ($mediaTypeParts['subtype']) {
            case 'json':
            case 'x-json':
            case 'javascript':
            case 'x-javascript':
                $result = json_decode($requestBody, true);
                if ($result === null) {
                    return [];
                }
            break;
            case 'xml':
                $entityLoaderValue = libxml_disable_entity_loader(true);
                try {
                    $xmlElement = new \SimpleXMLElement(urldecode($requestBody), LIBXML_NOERROR);
                    libxml_disable_entity_loader($entityLoaderValue);
                } catch (\Exception $exception) {
                    libxml_disable_entity_loader($entityLoaderValue);
                    return [];
                }
                $result = Arrays::convertObjectToArray($xmlElement);
            break;
            case 'x-www-form-urlencoded':
            default:
                parse_str($requestBody, $result);
            break;
        }
        return $result;
    }