<commit_before><?php
/**
 * @author <NAME> <<EMAIL>>
 */

namespace Annotatecms\Latte;

use Illuminate\View\Engines\EngineInterface;
use Nette\Caching\Storages\PhpFileStorage;
use Nette\Latte\Compiler;
use Nette\Templating\FileTemplate;

class Engine implements EngineInterface {

    /**
     * Get the evaluated contents of the view.
     *
     * @param  string $path
     * @param  array  $data
     *
     * @return string
     */
    public function get($path, array $data = array()) {
        $template = new FileTemplate($path);
        $template->setParameters($data);

        $filters = \Config::get("latte::latte.filters", array());
        $helpers = \Config::get("latte::latte.helpers", array());

        $cacheDirectory = \Config::get("latte::latte.cacheDirectory");

//        $template->setCacheStorage(new PhpFileStorage($cacheDirectory));

        $latte = new \Nette\Latte\Engine();
        $template->registerFilter($latte);

        if(count($filters)) {
            $compiler = $latte->getCompiler();
            foreach ($filters as $filterClass) {
                $filterClass::install($compiler);
            }
        }

        foreach ($helpers as $helperLoader) {
            $template->registerHelperLoader($helperLoader);
        }

        $template->render();
    }

}<commit_msg>Fixed caching - line was commented in development and I forgot to uncomment it<commit_after><?php
/**
 * @author <NAME> <<EMAIL>>
 */

namespace Annotatecms\Latte;

use Illuminate\View\Engines\EngineInterface;
use Nette\Caching\Storages\PhpFileStorage;
use Nette\Latte\Compiler;
use Nette\Templating\FileTemplate;

class Engine implements EngineInterface {

    /**
     * Get the evaluated contents of the view.
     *
     * @param  string $path
     * @param  array  $data
     *
     * @return string
     */
    public function get($path, array $data = array()) {
        $template = new FileTemplate($path);
        $template->setParameters($data);

        $filters = \Config::get("latte::latte.filters", array());
        $helpers = \Config::get("latte::latte.helpers", array());

        $cacheDirectory = \Config::get("latte::latte.cacheDirectory");

        $template->setCacheStorage(new PhpFileStorage($cacheDirectory));

        $latte = new \Nette\Latte\Engine();
        $template->registerFilter($latte);

        if(count($filters)) {
            $compiler = $latte->getCompiler();
            foreach ($filters as $filterClass) {
                $filterClass::install($compiler);
            }
        }

        foreach ($helpers as $helperLoader) {
            $template->registerHelperLoader($helperLoader);
        }

        $template->render();
    }

}
{'fraction_non_alphanumeric': 0.14370590419606388, 'fraction_numerical': 0.0, 'mean_word_length': 2.6454668470906633, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '5087052', 'n_tokens_mistral': 779, 'n_tokens_neox': 769, 'n_words': 154}