<commit_before><?php
/**
 * Created by PhpStorm.
 * User: manuelmeister
 * Date: 12.05.15
 * Time: 21:34
 */

namespace ThePost\View;

/**
 * Class View
 * @package ThePost\View
 */
class View {

    /**
     * @var \Twig_Loader_Filesystem
     */
    private $loader;
    /**
     * @var \Twig_Environment
     */
    protected $twig;
    /**
     * @var \Twig_TemplateInterface
     */
    protected $template;

    /**
     *
     */
    function __construct()
    {
        \Twig_Autoloader::register();
        $this->loader = new \Twig_Loader_Filesystem(__DIR__.'/Templates');
        $this->twig = new \Twig_Environment($this->loader);
    }

    /**
     * @param $filename
     */
    protected function set_template($filename){
        $this->template = $this->twig->loadTemplate($filename);
    }
}<commit_msg>Added render_vars Moved render to this class<commit_after><?php
/**
 * Created by PhpStorm.
 * User: manuelmeister
 * Date: 12.05.15
 * Time: 21:34
 */

namespace ThePost\View;


/**
 * Class View
 * @package ThePost\View
 */
class View
{

    /**
     * @var \Twig_Loader_Filesystem
     */
    private $loader;

    /**
     * @var \Twig_Environment
     */
    protected $twig;

    /**
     * @var \Twig_TemplateInterface
     */
    protected $template;

    /**
     * @var array
     */
    protected $render_vars = array();

    /**
     *
     */
    function __construct()
    {
        \Twig_Autoloader::register();
        $this->loader = new \Twig_Loader_Filesystem(__DIR__ . '/Templates');
        $this->twig = new \Twig_Environment($this->loader);
    }

    /**
     * @param $options
     * @param $authentication
     */
    public function set_render_vars($options, $authentication)
    {
        $this->render_vars['options'] = $options;
        $this->render_vars['authentication'] = $authentication;
    }

    /**
     * @param $arr
     */
    public function add_render_vars($arr)
    {
        foreach ($arr as $var => $val) {
            $this->render_vars[$var] = $val;
        }
    }

    /**
     * @param $filename
     */
    protected function set_template($filename)
    {
        $this->template = $this->twig->loadTemplate($filename);
    }

    /**
     * @return string
     */
    public function render()
    {
        return $this->template->render($this->render_vars);
    }
}
{'fraction_non_alphanumeric': 0.15420760358821017, 'fraction_numerical': 0.00854335753951303, 'mean_word_length': 2.0574412532637076, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '4473820', 'n_tokens_mistral': 778, 'n_tokens_neox': 751, 'n_words': 135}