<commit_before><?php

/**
 * This file is part of the Miny framework.
 * (c) <NAME> <<EMAIL>>
 *
 * For licensing information see the LICENSE file.
 */

namespace Modules\Templating;

use Miny\Application\BaseApplication;
use Miny\AutoLoader;
use Miny\Factory\Container;
use Miny\HTTP\Request;
use Miny\HTTP\Response;
use Modules\Templating\Extensions\Miny;
use UnexpectedValueException;

class Module extends \Miny\Modules\Module
{

    public function defaultConfiguration()
    {
        return array(
            'options' => array(
                'reload'           => false,
                'global_variables' => array(),
                'cache_namespace'  => 'Application\\Templating\\Cached',
                'strict_mode'      => true,
                'cache_path'       => 'templates/compiled/%s.php',
                'template_path'    => 'templates/%s.tpl',
                'autoescape'       => true,
                'delimiters'       => array(
                    'tag'     => array('{', '}'),
                    'comment' => array('{#', '#}')
                )
            ),
            'codes'   => array()
        );
    }

    public function init(BaseApplication $app)
    {
        $container = $app->getContainer();

        /** @var $autoLoader AutoLoader */
        $autoLoader = $container->get('\\Miny\\AutoLoader');
        $this->setupAutoLoader($autoLoader);

        $options = $this->getConfiguration('options');
        $container->addConstructorArguments(__NAMESPACE__ . '\\Environment', $options);
        $container->addCallback(
            __NAMESPACE__ . '\\Environment',
            function (Environment $environment, Container $container) {
                /** @var $minyExtension Miny */
                $minyExtension = $container->get(__NAMESPACE__ . '\\Extensions\\Miny');
                $environment->addExtension($minyExtension);
            }
        );
<commit_msg>Only read configuration when Environment is being initialized<commit_after><?php

/**
 * This file is part of the Miny framework.
 * (c) <NAME> <<EMAIL>>
 *
 * For licensing information see the LICENSE file.
 */

namespace Modules\Templating;

use Miny\Application\BaseApplication;
use Miny\AutoLoader;
use Miny\Factory\Container;
use Miny\HTTP\Request;
use Miny\HTTP\Response;
use Modules\Templating\Extensions\Miny;
use UnexpectedValueException;

class Module extends \Miny\Modules\Module
{

    public function defaultConfiguration()
    {
        return array(
            'options' => array(
                'reload'           => false,
                'global_variables' => array(),
                'cache_namespace'  => 'Application\\Templating\\Cached',
                'strict_mode'      => true,
                'cache_path'       => 'templates/compiled/%s.php',
                'template_path'    => 'templates/%s.tpl',
                'autoescape'       => true,
                'delimiters'       => array(
                    'tag'     => array('{', '}'),
                    'comment' => array('{#', '#}')
                )
            ),
            'codes'   => array()
        );
    }

    public function init(BaseApplication $app)
    {
        $container = $app->getContainer();

        /** @var $autoLoader AutoLoader */
        $autoLoader = $container->get('\\Miny\\AutoLoader');
        $this->setupAutoLoader($autoLoader);

        $module = $this;
        $container->addAlias(__NAMESPACE__ . '\\Environment', function() use($module) {
                $options = $this->getConfiguration('options');
                return new Environment($options);
            });
        $container->addCallback(
            __NAMESPACE__ . '\\Environment',
            function (Environment $environment, Container $container) {
                /** @var $minyExtension Miny */
                $minyExtension = $container->get(__NAMESPACE__ . '\\Extensions\\Miny');
                $environment->addExtension($minyExtension);
            }
        );

{'fraction_non_alphanumeric': 0.13858900326387144, 'fraction_numerical': 0.0, 'mean_word_length': 1.8974545454545455, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 49, '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': '1821706', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1053, 'n_words': 213}