src/Valkyrja/Http/NativeRequest.php
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';
    }
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';
    }
Gets the format associated with the mime type.

@param string $mimeType The associated mime type

@return string