<commit_before><?php


namespace Floppy\Bundle\Twig\Extensions;

use Floppy\Bundle\UrlGenerator\FilterSetApplier;
use Floppy\Client\UrlGenerator;
use Floppy\Common\FileId;
use Floppy\Bundle\View\PreviewRenderer;

class FloppyExtension extends \Twig_Extension
{
    private $urlGenerator;
    private $previewRenderer;
    private $filterSetApplier;

    public function __construct(UrlGenerator $urlGenerator, PreviewRenderer $previewRenderer, FilterSetApplier $filterSetApplier)
    {
        $this->urlGenerator = $urlGenerator;
        $this->previewRenderer = $previewRenderer;
        $this->filterSetApplier = $filterSetApplier;
    }

    public function getFunctions()
    {

        return array(
            new \Twig_SimpleFunction('floppy_url', array($this, 'getUrl')),
            new \Twig_SimpleFunction('floppy_file_preview', array($this, 'renderPreview'), array('needs_environment' => true, 'is_safe' => array('html'))),
        );
    }

    public function getFilters()
    {
        return array(
            new \Twig_SimpleFilter('floppy_filter', array($this, 'filter')),
        );
    }

    public function getUrl(FileId $fileId)
    {
        $argsCount = func_num_args();<commit_msg>mark floppy_url twig function as safe in html context<commit_after><?php


namespace Floppy\Bundle\Twig\Extensions;

use Floppy\Bundle\UrlGenerator\FilterSetApplier;
use Floppy\Client\UrlGenerator;
use Floppy\Common\FileId;
use Floppy\Bundle\View\PreviewRenderer;

class FloppyExtension extends \Twig_Extension
{
    private $urlGenerator;
    private $previewRenderer;
    private $filterSetApplier;

    public function __construct(UrlGenerator $urlGenerator, PreviewRenderer $previewRenderer, FilterSetApplier $filterSetApplier)
    {
        $this->urlGenerator = $urlGenerator;
        $this->previewRenderer = $previewRenderer;
        $this->filterSetApplier = $filterSetApplier;
    }

    public function getFunctions()
    {

        return array(
            new \Twig_SimpleFunction('floppy_url', array($this, 'getUrl'), array('is_safe' => array('html'))),
            new \Twig_SimpleFunction('floppy_file_preview', array($this, 'renderPreview'), array('needs_environment' => true, 'is_safe' => array('html'))),
        );
    }

    public function getFilters()
    {
        return array(
            new \Twig_SimpleFilter('floppy_filter', array($this, 'filter')),
        );
    }

    public function getUrl(FileId $fileId)
    {
        $argsCount = func_num_args();
{'fraction_non_alphanumeric': 0.11342685370741483, 'fraction_numerical': 0.0, 'mean_word_length': 3.5714285714285716, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '7640797', 'n_tokens_mistral': 747, 'n_tokens_neox': 717, 'n_words': 143}