<commit_before><?php

namespace Berti\Twig;

class Extension extends \Twig_Extension
{
    private $markdownRenderer;
    private $cwd;

    public function __construct(callable $markdownRenderer)
    {
        $this->markdownRenderer = $markdownRenderer;
    }

    public function getFilters()
    {
        return [
            new \Twig_Filter(
                'markdown',
                [$this, 'renderMarkdown'],
                ['is_safe' => ['html']]
            )
        ];
    }

    public function setCwd(string $cwd = null)
    {
        $currentCwd = $this->cwd;
        $this->cwd = $cwd;

        return $currentCwd;
    }

    public function renderMarkdown(string $content, array $options = [])
    {
        if (!array_key_exists('cwd', $options)) {
            $options['cwd'] = $this->cwd;
        }

        return call_user_func(
            $this->markdownRenderer,
            $content,
            $options
        );
    }

    public function getTokenParsers()
    {
        return [
            new MarkdownTokenParser()
        ];
    }
}
<commit_msg>Restructure extension<commit_after><?php

namespace Berti\Twig;

class Extension extends \Twig_Extension
{
    private $markdownRenderer;
    private $cwd;

    public function __construct(callable $markdownRenderer)
    {
        $this->markdownRenderer = $markdownRenderer;
    }

    public function getTokenParsers()
    {
        return [
            new MarkdownTokenParser()
        ];
    }

    public function getFilters()
    {
        return [
            new \Twig_Filter(
                'markdown',
                [$this, 'markdown'],
                ['is_safe' => ['html']]
            )
        ];
    }

    public function setCwd(string $cwd = null)
    {
        $currentCwd = $this->cwd;
        $this->cwd = $cwd;

        return $currentCwd;
    }

    public function markdown(string $content, array $options = [])
    {
        if (!array_key_exists('cwd', $options)) {
            $options['cwd'] = $this->cwd;
        }

        return call_user_func(
            $this->markdownRenderer,
            $content,
            $options
        );
    }
}

{'fraction_non_alphanumeric': 0.11563367252543941, 'fraction_numerical': 0.0, 'mean_word_length': 1.683622828784119, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '2322091', 'n_tokens_mistral': 654, 'n_tokens_neox': 623, 'n_words': 123}