<commit_before><?php
/**
 * Webino (http://webino.sk)
 *
 * @link        https://github.com/webino/WebinoDraw for the canonical source repository
 * @copyright   Copyright (c) 2013 Webino, s. r. o. (http://webino.sk)
 * @author      <NAME> <<EMAIL>>
 * @license     New BSD License
 */

namespace WebinoDraw\View\Helper;

use ArrayAccess;
use WebinoDraw\Dom\Element;
use WebinoDraw\Dom\NodeList;

/**
 *
 */
class DrawTranslate extends DrawElement
{
    /**
     * Return callable to set node value
     *
     * @param array $spec
     * @return Closure
     */
    public function createValuePreSet(array $spec, ArrayAccess $translation)
    {
        $helper = $this;

        return function (
            Element $node,
            $value
        ) use (
            $helper,
            $spec,
            $translation
        ) {
            $textDomain = !empty($spec['text_domain']) ? $spec['text_domain'] : 'default';
            $varValue   = $helper->translatePreSet($node, $value, $spec, clone $translation);

            if (empty($varValue)) {
                return '';
            }
            return $helper->view->translate($varValue, $textDomain);
        };
    }

    /**
     * Return callable to set node attributes
     *
     * @param array $spec
     * @return Closure
     */
    public function createAttribsPreSet(array $spec, ArrayAccess $translation)
    {
        $varTranslator = $this->getVarTranslator();
        $helper        = $this;

        return function (
            Element $node,
            $value
        ) use (
            $helper,
            $spec,
            $translation,
            $varTranslator
        ) {
            $textDomain = !empty($spec['text_domain']) ? $spec['text_domain'] : 'default';
            $varValue   = $helper->translatePreSet($node, $value, $spec, clone $translation);

            if (empty($varValue)) {
                return '';
            }
            return $helper->view->translate($varValue, $textDomain);
        };
    }

    /**
     * @param NodeList $nodes
     * @param array $spec
     * @return DrawPagination
     */
    public function drawNodes(NodeList $nodes, array $spec)
    {
        return parent::drawNodes($nodes, $spec);
    }
}<commit_msg>Fixed DrawTranslate, ->view to ->getView()<commit_after><?php
/**
 * Webino (http://webino.sk)
 *
 * @link        https://github.com/webino/WebinoDraw for the canonical source repository
 * @copyright   Copyright (c) 2013 Webino, s. r. o. (http://webino.sk)
 * @author      <NAME> <<EMAIL>>
 * @license     New BSD License
 */

namespace WebinoDraw\View\Helper;

use ArrayAccess;
use WebinoDraw\Dom\Element;
use WebinoDraw\Dom\NodeList;

/**
 *
 */
class DrawTranslate extends DrawElement
{
    /**
     * Return callable to set node value
     *
     * @param array $spec
     * @return Closure
     */
    public function createValuePreSet(array $spec, ArrayAccess $translation)
    {
        $helper = $this;

        return function (
            Element $node,
            $value
        ) use (
            $helper,
            $spec,
            $translation
        ) {
            $textDomain = !empty($spec['text_domain']) ? $spec['text_domain'] : 'default';
            $varValue   = $helper->translatePreSet($node, $value, $spec, clone $translation);

            if (empty($varValue)) {
                return '';
            }
            return $helper->getView()->translate($varValue, $textDomain);
        };
    }

    /**
     * Return callable to set node attributes
     *
     * @param array $spec
     * @return Closure
     */
    public function createAttribsPreSet(array $spec, ArrayAccess $translation)
    {
        $varTranslator = $this->getVarTranslator();
        $helper        = $this;

        return function (
            Element $node,
            $value
        ) use (
            $helper,
            $spec,
            $translation,
            $varTranslator
        ) {
            $textDomain = !empty($spec['text_domain']) ? $spec['text_domain'] : 'default';
            $varValue   = $helper->translatePreSet($node, $value, $spec, clone $translation);

            if (empty($varValue)) {
                return '';
            }
            return $helper->getView()->translate($varValue, $textDomain);
        };
    }

    /**
     * @param NodeList $nodes
     * @param array $spec
     * @return DrawPagination
     */
    public function drawNodes(NodeList $nodes, array $spec)
    {
        return parent::drawNodes($nodes, $spec);
    }
}
{'fraction_non_alphanumeric': 0.1317352100285903, 'fraction_numerical': 0.0017594018033868484, 'mean_word_length': 1.8585795097423004, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 2, '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': '2263971', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1286, 'n_words': 296}