<commit_before><?php

/*
 * This file is part of Twig.
 *
 * (c) 2009 <NAME>
 * (c) 2009 <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * Represents a module node.
 *
 * Consider this class as being final. If you need to customize the behavior of
 * the generated class, consider adding nodes to the following nodes: display_start,
 * display_end, constructor_start, constructor_end, and class_end.
 *
 * @author <NAME> <<EMAIL>>
 */
class Apishka_Templater_Node_Module extends Apishka_Templater_NodeAbstract
{
    public function __construct(Apishka_Templater_NodeAbstract $body, Apishka_Templater_Node_ExpressionAbstract $parent = null, Apishka_Templater_NodeAbstract $blocks, Apishka_Templater_NodeAbstract $macros, Apishka_Templater_NodeAbstract $traits, $embeddedTemplates, $filename)
    {
        // embedded templates are set as attributes so that they are only visited once by the visitors
        parent::__construct(array(
            'parent'            => $parent,
            'body'              => $body,
            'blocks'            => $blocks,
            'macros'            => $macros,
            'traits'            => $traits,
            'display_start'     => Apishka_Templater_Node::apishka(),
            'display_end'       => Apishka_Templater_Node::apishka(),
            'constructor_start' => Apishka_Templater_Node::apishka(),
            'constructor_end'   => Apishka_Templater_Node::apishka(),
            'class_end'         => Apishka_Templater_Node::apishka(),
        ), array(
            'filename'           => $filename,
            'index'              => null,
            'embedded_templates' => $embeddedTemplates,
        ), 1);
    }

    public function setIndex($index)
    {
        $this->setAttribute('index', $index);
    }

    public function compile(Apishka_Templater_Compiler $compiler)
    {
        $this->compileTemplate($compiler);

        foreach ($this->getAttribute('embedded_templates') as $template) {
            $compiler->subcompile($template);
        }
    }

    protected function compileTemplate(Apishka_Templater_Compiler $compiler)
    {
        if (!$this->getAttribute('index')) {
            $compiler->write('<?php');
        }

        $this->compileClassHeader($compiler);

        if (
            count($this->getNode('blocks'))
            || count($this->getNode('traits'))
            || null === $this->getNode('parent')
            || $this->getNode('parent') instanceof Apishka_Templater_Node_Expression_Constant
            || count($this->getNode('constructor_start'))
            || count($this->getNode('constructor_end'))
        ) {
            $this->compileConstructor($compiler);
        }

        $this->compileApishkaName($compiler);

        $this->compileGetParent($compiler);

        $this->compileDisplay($compiler);

        $compiler->subcompile($this->getNode('blocks'));

        $this->compileMacros($compiler);

        $this->compileGetTemplateName($compiler);

        $this->compileIsTraitable($compiler);

        $this->compileDebugInfo($compiler);

        $this->compileClassFooter($compiler);
    }

    /**
     * Compile apishka name
     *
     * @param Apishka_Templater_Compiler $compiler
     */

    protected function compileApishkaName(Apishka_Templater_Compiler $compiler)
    {
        $compiler
            ->write("public function getSupportedNames()\n", "{\n")
            ->indent()
            ->write('return array(' . PHP_EOL)
            ->indent()
            ->write(sprintf("'%s',", $compiler->getEnvironment()->getTemplateClass($this->getAttribute('filename'), $this->getAttribute('index'))) . PHP_EOL)
            ->outdent()
            ->write(');' . PHP_EOL)
            ->outdent()
            ->write('}' . PHP_EOL . PHP_EOL)
        ;
    }

    protected function compileGetParent(Apishka_Templater_Compiler $compiler)
    {<commit_msg>draw filename in apishka names<commit_after><?php

/*
 * This file is part of Twig.
 *
 * (c) 2009 Fabien Potencier
 * (c) 2009 <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * Represents a module node.
 *
 * Consider this class as being final. If you need to customize the behavior of
 * the generated class, consider adding nodes to the following nodes: display_start,
 * display_end, constructor_start, constructor_end, and class_end.
 *
 * @author <NAME> <<EMAIL>>
 */
class Apishka_Templater_Node_Module extends Apishka_Templater_NodeAbstract
{
    public function __construct(Apishka_Templater_NodeAbstract $body, Apishka_Templater_Node_ExpressionAbstract $parent = null, Apishka_Templater_NodeAbstract $blocks, Apishka_Templater_NodeAbstract $macros, Apishka_Templater_NodeAbstract $traits, $embeddedTemplates, $filename)
    {
        // embedded templates are set as attributes so that they are only visited once by the visitors
        parent::__construct(array(
            'parent'            => $parent,
            'body'              => $body,
            'blocks'            => $blocks,
            'macros'            => $macros,
            'traits'            => $traits,
            'display_start'     => Apishka_Templater_Node::apishka(),
            'display_end'       => Apishka_Templater_Node::apishka(),
            'constructor_start' => Apishka_Templater_Node::apishka(),
            'constructor_end'   => Apishka_Templater_Node::apishka(),
            'class_end'         => Apishka_Templater_Node::apishka(),
        ), array(
            'filename'           => $filename,
            'index'              => null,
            'embedded_templates' => $embeddedTemplates,
        ), 1);
    }

    public function setIndex($index)
    {
        $this->setAttribute('index', $index);
    }

    public function compile(Apishka_Templater_Compiler $compiler)
    {
        $this->compileTemplate($compiler);

        foreach ($this->getAttribute('embedded_templates') as $template) {
            $compiler->subcompile($template);
        }
    }

    protected function compileTemplate(Apishka_Templater_Compiler $compiler)
    {
        if (!$this->getAttribute('index')) {
            $compiler->write('<?php');
        }

        $this->compileClassHeader($compiler);

        if (
            count($this->getNode('blocks'))
            || count($this->getNode('traits'))
            || null === $this->getNode('parent')
            || $this->getNode('parent') instanceof Apishka_Templater_Node_Expression_Constant
            || count($this->getNode('constructor_start'))
            || count($this->getNode('constructor_end'))
        ) {
            $this->compileConstructor($compiler);
        }

        $this->compileApishkaName($compiler);

        $this->compileGetParent($compiler);

        $this->compileDisplay($compiler);

        $compiler->subcompile($this->getNode('blocks'));

        $this->compileMacros($compiler);

        $this->compileGetTemplateName($compiler);

        $this->compileIsTraitable($compiler);

        $this->compileDebugInfo($compiler);

        $this->compileClassFooter($compiler);
    }

    /**
     * Compile apishka name
     *
     * @param Apishka_Templater_Compiler $compiler
     */

    protected function compileApishkaName(Apishka_Templater_Compiler $compiler)
    {
        $compiler
            ->write("public function getSupportedNames()\n", "{\n")
            ->indent()
            ->write('return array(' . PHP_EOL)
            ->indent()
            ->write(sprintf("'%s',", $this->getAttribute('filename')) . PHP_EOL)
            ->outdent()
            ->write(');' . PHP_EOL)
            ->outdent()
            ->write('}' . PHP_EOL . PHP_EOL)
        ;
    }

    protected function compileGetParent(Apishka_Templater_Compiler $compiler)
    {
{'fraction_non_alphanumeric': 0.12786596119929453, 'fraction_numerical': 0.0022675736961451248, 'mean_word_length': 2.4820175438596492, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 109, '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': '2876291', 'n_tokens_mistral': 2238, 'n_tokens_neox': 2196, 'n_words': 426}