<commit_before><?php

namespace Psr7Middlewares\Middleware;

use Psr7Middlewares\Middleware;
use Psr7Middlewares\Utils;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Negotiation\Negotiator;

/**
 * Middleware returns the client preferred format.
 */
class FormatNegotiator
{
    use Utils\NegotiateTrait;

    const KEY = 'FORMAT';

    /**
     * @var string Default format
     */
    private $default = 'html';

    /**
     * @var array Available formats with the mime types
     */
    private $formats = [
        'html' => ['text/html', 'application/xhtml+xml'],
        'css' => ['text/css'],
        'gif' => ['image/gif'],
        'png' => ['image/png', 'image/x-png'],
        'jpg' => ['image/jpeg', 'image/jpg'],
        'jpeg' => ['image/jpeg', 'image/jpg'],
        'json' => ['application/json', 'text/json', 'application/x-json'],
        'jsonp' => ['text/javascript', 'application/javascript', 'application/x-javascript'],
        'js' => ['text/javascript', 'application/javascript', 'application/x-javascript'],
        'pdf' => ['application/pdf', 'application/x-download'],
        'rdf' => ['application/rdf+xml'],
        'rss' => ['application/rss+xml'],
        'atom' => ['application/atom+xml'],
        'xml' => ['text/xml', 'application/xml', 'application/x-xml'],
        'txt' => ['text/plain'],
        'mp4' => ['video/mp4'],
        'ogg' => ['audio/ogg'],
        'ogv' => ['video/ogg'],
        'webm' => ['video/webm'],
        'webp' => ['image/webp'],
        'svg' => ['image/svg+xml'],
        'zip' => ['application/zip', 'application/x-zip', 'application/x-zip-compressed'],
    ];

    /**
     * Returns the format.
     *
     * @param ServerRequestInterface $request
     *
     * @return string|null
     */<commit_msg>added font mimetypes to formatnegotiator<commit_after><?php

namespace Psr7Middlewares\Middleware;

use Psr7Middlewares\Middleware;
use Psr7Middlewares\Utils;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Negotiation\Negotiator;

/**
 * Middleware returns the client preferred format.
 */
class FormatNegotiator
{
    use Utils\NegotiateTrait;

    const KEY = 'FORMAT';

    /**
     * @var string Default format
     */
    private $default = 'html';

    /**
     * @var array Available formats with the mime types
     */
    private $formats = [
        'html' => ['text/html', 'application/xhtml+xml'],
        'css' => ['text/css'],
        'gif' => ['image/gif'],
        'png' => ['image/png', 'image/x-png'],
        'jpg' => ['image/jpeg', 'image/jpg'],
        'jpeg' => ['image/jpeg', 'image/jpg'],
        'json' => ['application/json', 'text/json', 'application/x-json'],
        'jsonp' => ['text/javascript', 'application/javascript', 'application/x-javascript'],
        'js' => ['text/javascript', 'application/javascript', 'application/x-javascript'],
        'pdf' => ['application/pdf', 'application/x-download'],
        'rdf' => ['application/rdf+xml'],
        'rss' => ['application/rss+xml'],
        'atom' => ['application/atom+xml'],
        'xml' => ['text/xml', 'application/xml', 'application/x-xml'],
        'txt' => ['text/plain'],
        'mp4' => ['video/mp4'],
        'otf' => ['font/opentype'],
        'ttf' => ['font/ttf', 'application/font-ttf', 'application/x-font-ttf'],
        'ogg' => ['audio/ogg'],
        'ogv' => ['video/ogg'],
        'webm' => ['video/webm'],
        'woff' => ['font/woff', 'application/font-woff', 'application/x-font-woff'],
        'webp' => ['image/webp'],
        'svg' => ['image/svg+xml'],
        'zip' => ['application/zip', 'application/x-zip', 'application/x-zip-compressed'],
    ];

    /**
     * Returns the format.
     *
     * @param ServerRequestInterface $request
     *
     * @return string|null
     */
{'fraction_non_alphanumeric': 0.2045159615883727, 'fraction_numerical': 0.0025953802232026994, 'mean_word_length': 2.7453838678328473, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '911950', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1225, 'n_words': 234}