<commit_before><?php


namespace Kibo\Phast\Filters\CSS\FontSwap;


use Kibo\Phast\Services\ServiceFilter;
use Kibo\Phast\ValueObjects\Resource;

class Filter implements ServiceFilter {

    const FONT_FACE_REGEXP = '/@font-face\s*\{/is';

    public function apply(Resource $resource, array $request) {
        $css = $resource->getContent();
        $filtered = preg_replace(self::FONT_FACE_REGEXP, '$0font-display: swap;', $css);
        return $resource->withContent($filtered);
    }
}<commit_msg>Do not care about new lines when setting font-display: swap<commit_after><?php


namespace Kibo\Phast\Filters\CSS\FontSwap;


use Kibo\Phast\Services\ServiceFilter;
use Kibo\Phast\ValueObjects\Resource;

class Filter implements ServiceFilter {

    const FONT_FACE_REGEXP = '/@font-face\s*\{/i';

    public function apply(Resource $resource, array $request) {
        $css = $resource->getContent();
        $filtered = preg_replace(self::FONT_FACE_REGEXP, '$0font-display: swap;', $css);
        return $resource->withContent($filtered);
    }
}
{'fraction_non_alphanumeric': 0.13536701620591038, 'fraction_numerical': 0.0019065776930409914, 'mean_word_length': 4.172413793103448, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1768261', 'n_tokens_mistral': 345, 'n_tokens_neox': 327, 'n_words': 67}