<commit_before><?php
/**
 * Created by PhpStorm.
 * User: claudio
 * Date: 14-08-15
 * Time: 3:18
 */

namespace AscensoDigital\ComponentBundle\Twig;


class ADExtension extends \Twig_Extension {

    private $layout;

    public function __construct($layout) {
        $this->layout=$layout;
    }

    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('ad_component_get_layout',array($this,'getLayout'))
        );
    }

    public function getFilters()
    {
        return array(
            new \Twig_SimpleFilter('utf8_decode', 'utf8_decode'),
            new \Twig_SimpleFilter('utf8_encode', 'utf8_encode'),
            new \Twig_SimpleFilter('nl2br','nl2br'),
        );
    }

    public function getOperators()
    {
        return array(
            array(
                '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'),
            ),
            array(
                '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
                '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
            ),
        );
    }

    public function getLayout() {
        return $this->layout;
    }
    
    public function getName() {
        return 'ad_extension';
    }
}
<commit_msg>se agrega funcion para validar tipo numeric<commit_after><?php
/**
 * Created by PhpStorm.
 * User: claudio
 * Date: 14-08-15
 * Time: 3:18
 */

namespace AscensoDigital\ComponentBundle\Twig;


class ADExtension extends \Twig_Extension {

    private $layout;

    public function __construct($layout) {
        $this->layout=$layout;
    }

    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('ad_component_get_layout',array($this,'getLayout'))
        );
    }

    public function getFilters()
    {
        return array(
            new \Twig_SimpleFilter('utf8_decode', 'utf8_decode'),
            new \Twig_SimpleFilter('utf8_encode', 'utf8_encode'),
            new \Twig_SimpleFilter('nl2br','nl2br'),
            new \Twig_SimpleFilter('is_numeric','is_numeric'),
        );
    }

    public function getOperators()
    {
        return array(
            array(
                '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'),
            ),
            array(
                '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
                '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
            ),
        );
    }

    public function getLayout() {
        return $this->layout;
    }
    
    public function getName() {
        return 'ad_extension';
    }
}

{'fraction_non_alphanumeric': 0.13442842775729133, 'fraction_numerical': 0.014079785450888367, 'mean_word_length': 2.390909090909091, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '3583004', 'n_tokens_mistral': 940, 'n_tokens_neox': 889, 'n_words': 158}