<commit_before><?php
/*
 * Copyright (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace PHPoole\Renderer;

use Symfony\Component\Filesystem\Filesystem;

/**
 * Class Twig.
 */
class Twig implements RendererInterface
{
    /**
     * @var \Twig_Environment
     */
    protected $twig;
    /**
     * @var string
     */
    protected $templatesDir;
    /**
     * @var string
     */
    protected $rendered;
    /**
     * @var Filesystem
     */
    protected $fs;
    /**
     * @var bool
     */
    protected $twigStrict = true;
    /**
     * @var bool
     */
    protected $twigDebug = true;
    /*
     * @var string|bool
     */
    protected $twigCache = false;

    /**
     * {@inheritdoc}
     */
    public function __construct($templatesPath, $destPath)
    {
        $loaderFS = new \Twig_Loader_Filesystem($templatesPath);
        $loaderArray = new \Twig_Loader_Array([
            'redirect.html.twig' => '<!DOCTYPE html>
<html>
<head lang="en">
    <link rel="canonical" href="{{ url(page.destination) }}"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="refresh" content="0;url={{ url(page.destination) }}" />
</head>
</html>',
        ]);
        $loader = new \Twig_Loader_Chain([$loaderArray, $loaderFS]);
        $this->twig = new \Twig_Environment($loader,
            [
                'autoescape'       => false,
                'strict_variables' => $this->twigStrict,
                'debug'            => $this->twigDebug,
                'cache'            => $this->twigCache,
            ]
        );
        $this->twig->addExtension(new \Twig_Extension_Debug());
        $this->twig->addExtension(new TwigExtensionSorts());
        $this->twig->addExtension(new TwigExtensionFilters());
        $this->twig->addExtension(new TwigExtensionUrlize());
        $this->twig->addExtension(new TwigExtensionMinify($destPath));

        // excerpt filter<commit_msg>Twig default date format and timezone.<commit_after><?php
/*
 * Copyright (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace PHPoole\Renderer;

use Symfony\Component\Filesystem\Filesystem;

/**
 * Class Twig.
 */
class Twig implements RendererInterface
{
    /**
     * @var \Twig_Environment
     */
    protected $twig;
    /**
     * @var string
     */
    protected $templatesDir;
    /**
     * @var string
     */
    protected $rendered;
    /**
     * @var Filesystem
     */
    protected $fs;
    /**
     * @var bool
     */
    protected $twigStrict = true;
    /**
     * @var bool
     */
    protected $twigDebug = true;
    /*
     * @var string|bool
     */
    protected $twigCache = false;

    /**
     * {@inheritdoc}
     */
    public function __construct($templatesPath, $destPath)
    {
        $loaderFS = new \Twig_Loader_Filesystem($templatesPath);
        $loaderArray = new \Twig_Loader_Array([
            'redirect.html.twig' => '<!DOCTYPE html>
<html>
<head lang="en">
    <link rel="canonical" href="{{ url(page.destination) }}"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="refresh" content="0;url={{ url(page.destination) }}" />
</head>
</html>',
        ]);
        $loader = new \Twig_Loader_Chain([$loaderArray, $loaderFS]);
        $this->twig = new \Twig_Environment($loader,
            [
                'autoescape'       => false,
                'strict_variables' => $this->twigStrict,
                'debug'            => $this->twigDebug,
                'cache'            => $this->twigCache,
            ]
        );
        $this->twig->addExtension(new \Twig_Extension_Debug());
        $this->twig->addExtension(new TwigExtensionSorts());
        $this->twig->addExtension(new TwigExtensionFilters());
        $this->twig->addExtension(new TwigExtensionUrlize());
        $this->twig->addExtension(new TwigExtensionMinify($destPath));
        $this->twig->getExtension('core')->setDateFormat('F j, Y');
        $this->twig->getExtension('core')->setTimezone('Europe/Paris');

        // excerpt filter
{'fraction_non_alphanumeric': 0.15519253208868145, 'fraction_numerical': 0.0009334889148191366, 'mean_word_length': 2.2817764165390506, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 69, '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': '77057', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1298, 'n_words': 254}