<commit_before><?php
/**
 * Widget Framework
 *
 * @copyright   Copyright (c) 2008-2013 <NAME>
 * @license     http://www.opensource.org/licenses/apache2.0.php Apache License
 */

namespace Widget;

/**
 * Twig
 *
 * @package     Widget
 * @author      <NAME> <<EMAIL>>
 */
class Twig extends WidgetProvider implements Viewable
{
    /**
     * Options for \Twig_Environment
     *
     * @var array
     * @see \Twig_Environment::__construct
     */
    protected $envOptions = array(
        'debug'                 => false,
        'charset'               => 'UTF-8',
        'base_template_class'   => 'Twig_Template',
        'strict_variables'      => false,
        'autoescape'            => 'html',
        'cache'                 => false,
        'auto_reload'           => null,
        'optimizations'         => -1,
    );

    /**
     * Path for \Twig_Loader_Filesystem
     *
     * @var string|array
     */
    protected $paths = array();

    /**
     * Default template file extension
     *
     * @var string
     */
    protected $extension = '.html.twig';

    /**
     * The twig environment object
     *
     * @return \Twig_Environment
     */
    protected $twig;

    /**
     * Constructor
     *
     * @var array
     * @param array $options
     */
    public function __construct(array $options = array())
    {
        parent::__construct($options);

        $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem($this->paths), $this->envOptions);

        // add in common use object
        $this->twig->addGlobal('widget', $this->widget);
        $this->twig->addGlobal('app', $this->app);
    }

    /**
     * Get twig environment object
     *
     * @return \Twig_Environment
     */
    public function __invoke()
    {
        return $this->twig;
    }

    /**
     * @see \Widget\Viewable::assign
     */
    public function assign($name, $value = null)
    {
        $this->twig->addGlobal($name, $name);
    }

    /**
     * @see \Widget\Viewable::display
     * @param array $context
     */
    public function display($name, $context = array())
    {
        return $this->twig->display($name, $context);
    }

    /**
     * @see \Widget\Viewable::render
     * @param array $context
     */
    public function render($name, $context = array())<commit_msg>fixed variable typo<commit_after><?php
/**
 * Widget Framework
 *
 * @copyright   Copyright (c) 2008-2013 <NAME>
 * @license     http://www.opensource.org/licenses/apache2.0.php Apache License
 */

namespace Widget;

/**
 * Twig
 *
 * @package     Widget
 * @author      <NAME> <<EMAIL>>
 */
class Twig extends WidgetProvider implements Viewable
{
    /**
     * Options for \Twig_Environment
     *
     * @var array
     * @see \Twig_Environment::__construct
     */
    protected $envOptions = array(
        'debug'                 => false,
        'charset'               => 'UTF-8',
        'base_template_class'   => 'Twig_Template',
        'strict_variables'      => false,
        'autoescape'            => 'html',
        'cache'                 => false,
        'auto_reload'           => null,
        'optimizations'         => -1,
    );

    /**
     * Path for \Twig_Loader_Filesystem
     *
     * @var string|array
     */
    protected $paths = array();

    /**
     * Default template file extension
     *
     * @var string
     */
    protected $extension = '.html.twig';

    /**
     * The twig environment object
     *
     * @return \Twig_Environment
     */
    protected $twig;

    /**
     * Constructor
     *
     * @var array
     * @param array $options
     */
    public function __construct(array $options = array())
    {
        parent::__construct($options);

        $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem($this->paths), $this->envOptions);

        // add in common use object
        $this->twig->addGlobal('widget', $this->widget);
        $this->twig->addGlobal('app', $this->app);
    }

    /**
     * Get twig environment object
     *
     * @return \Twig_Environment
     */
    public function __invoke()
    {
        return $this->twig;
    }

    /**
     * @see \Widget\Viewable::assign
     */
    public function assign($name, $value = null)
    {
        $this->twig->addGlobal($name, $value);
    }

    /**
     * @see \Widget\Viewable::display
     * @param array $context
     */
    public function display($name, $context = array())
    {
        return $this->twig->display($name, $context);
    }

    /**
     * @see \Widget\Viewable::render
     * @param array $context
     */
    public function render($name, $context = array())
{'fraction_non_alphanumeric': 0.1460794844253491, 'fraction_numerical': 0.0051557465091299675, 'mean_word_length': 1.8477064220183486, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1414384', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1395, 'n_words': 293}