<commit_before><?php

namespace Droid\Transform\Render;

use LightnCandy\LightnCandy;

class LightnCandyRenderer implements RendererInterface
{
    public function render($value, $context = array())
    {
        $compiled = $this->compile($value);
        if ($compiled === false) {
            throw new RendererException('Failure to compile!');
        }

        $renderer = $this->prepare($compiled);
        if ($renderer === false) {
            throw new RendererException('Failure to prepare compiled template content.');
        }

        return $renderer($context);
    }

    protected function compile($templateContent)
    {
        return LightnCandy::compile(
            $templateContent,
            array('flags' => self::compilerFlags())
        );
    }

    protected function prepare($compiledTemplateContent)
    {
        return LightnCandy::prepare(
            $compiledTemplateContent
        );
    }

    private static function compilerFlags()
    {
        return
            LightnCandy::FLAG_INSTANCE
            | LightnCandy::FLAG_BESTPERFORMANCE
        ;
    }
}<commit_msg>Add FLAG_ELSE LightnCandy compiler option<commit_after><?php

namespace Droid\Transform\Render;

use LightnCandy\LightnCandy;

class LightnCandyRenderer implements RendererInterface
{
    public function render($value, $context = array())
    {
        $compiled = $this->compile($value);
        if ($compiled === false) {
            throw new RendererException('Failure to compile!');
        }

        $renderer = $this->prepare($compiled);
        if ($renderer === false) {
            throw new RendererException('Failure to prepare compiled template content.');
        }

        return $renderer($context);
    }

    protected function compile($templateContent)
    {
        return LightnCandy::compile(
            $templateContent,
            array('flags' => self::compilerFlags())
        );
    }

    protected function prepare($compiledTemplateContent)
    {
        return LightnCandy::prepare(
            $compiledTemplateContent
        );
    }

    private static function compilerFlags()
    {
        return
            LightnCandy::FLAG_INSTANCE
            | LightnCandy::FLAG_BESTPERFORMANCE
            | LightnCandy::FLAG_ELSE
        ;
    }
}
{'fraction_non_alphanumeric': 0.10257529463116544, 'fraction_numerical': 0.0, 'mean_word_length': 2.345985401459854, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2969780', 'n_tokens_mistral': 598, 'n_tokens_neox': 589, 'n_words': 125}