public function getFormat(string $mimeType): string
    {
        $canonicalMimeType = null;

        if (false !== $pos = strpos($mimeType, ';')) {
            $canonicalMimeType = substr($mimeType, 0, $pos);
        }

        foreach (static::FORMATS as $format => $mimeTypes) {
            if (\in_array($mimeType, $mimeTypes, true)) {
                return $format;
            }

            if (
                null !== $canonicalMimeType
                && \in_array(
                    $canonicalMimeType,
                    $mimeTypes,
                    true
                )
            ) {
                return $format;
            }
        }

        return 'html';
    }