protected static function getPreferredFormat(string $accept): string
    {
        if (static::isCli()) {
            return 'plain';
        }

        $formats = [
            'json' => ['application/json'],
            'html' => ['text/html'],
            'xml' => ['text/xml'],
            'plain' => ['text/plain', 'text/css', 'text/javascript'],
        ];

        foreach ($formats as $format => $mimes) {
            foreach ($mimes as $mime) {
                if (stripos($accept, $mime) !== false) {
                    return $format;
                }
            }
        }

        return 'unknown';
    }
protected static function getPreferredFormat(string $accept): string
    {
        if (static::isCli()) {
            return 'plain';
        }

        $formats = [
            'json' => ['application/json'],
            'html' => ['text/html'],
            'xml' => ['text/xml'],
            'plain' => ['text/plain', 'text/css', 'text/javascript'],
        ];

        foreach ($formats as $format => $mimes) {
            foreach ($mimes as $mime) {
                if (stripos($accept, $mime) !== false) {
                    return $format;
                }
            }
        }

        return 'unknown';
    }
protected static function getPreferredFormat ( string $ accept ) : string { if ( static :: isCli ( ) ) { return 'plain' ; } $ formats = [ 'json' => [ 'application/json' ] , 'html' => [ 'text/html' ] , 'xml' => [ 'text/xml' ] , 'plain' => [ 'text/plain' , 'text/css' , 'text/javascript' ] , ] ; foreach ( $ formats as $ format => $ mimes ) { foreach ( $ mimes as $ mime ) { if ( stripos ( $ accept , $ mime ) !== false ) { return $ format ; } } } return 'unknown' ; }
Returns the preferred format used by whoops.
Returns the preferred format used by whoops .