<commit_before><?php namespace Fadion\ValidatorAssistant;

class Filters {

    /**
    * @var array Filters
    */
    protected $filters = array();

    /**
    * @var mixed Inputs
    */
    private $inputs;

    /**
    * Initialize the Filters class.
    *
    * @param  array  $inputs
    * @param  string  $filters
    * @return void
    */
    public function __construct($inputs, $filters)
    {
        $this->inputs = $inputs;
        $this->filters = $filters;
    }

    /**
    * Apply filters to the inputs.
    *
    * @return array
    */
    public function apply()
    {
        $filters = $this->filters;
        $inputs = $this->inputs;

        if (count($filters)) {
            foreach ($filters as $name => $filter) {
                $rules = explode('|', $filter);

                // At least a rule is set and the input
                // field exists.
                if (count($rules) and isset($inputs[$name])) {
                    foreach ($rules as $rule) {
                        $rule = explode(':', $rule);

                        $argument = null;
                        if (isset($rule[1])) {
                            $argument = $rule[1];
                        }

                        $rule = strtolower($rule[0]);
                        $rule = str_replace('_', ' ', $rule);
                        $rule = str_replace(' ', '', ucwords($rule));

                        $method = 'filter'.$rule;

                        // Check if rule is defined as a class method.
                        if (method_exists($this, $method)) {
                            $inputs[$name] = $this->$method($inputs[$name], $argument);
                        }
                    }
                }
            }
        }

        return $inputs;
    }

    /**************
    *   FILTERS   *
    **************/

    /**
    * Trim filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterTrim($value, $argument = null)
    {
        return trim($value, $argument);
    }

    /**
    * Trim filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterLrim($value, $argument = null)
    {
        return ltrim($value, $argument);
    }

    /**
    * Trim filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterRtrim($value, $argument = null)
    {
        return rtrim($value, $argument);
    }

    /**
    * MD5 filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterMd5($value, $argument = null)
    {
        return md5($value);
    }

    /**
    * Sha1 filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterSha1($value, $argument = null)
    {
        return sha1($value);
    }

    /**
    * URL Encode filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterUrlEncode($value, $argument = null)
    {
        return urlencode($value);
    }

    /**
    * URL Decode filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterUrlDecode($value, $argument = null)
    {
        return urldecode($value);
    }

    /**
    * Strip Tags filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterStripTags($value, $argument = null)
    {
        $allowedTags = '<p><a><b><i><em><strong><img><br><ul><ol><li><span><blockquote><code><sub><sup><h1><h2><h3><h4><h5><h6><dd><dl><label>';

        return strip_tags($value, $allowedTags);
    }

    /**
    * HTMLEntities filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterHtmlentities($value, $argument = null)
    {
        return htmlentities($value, ENT_QUOTES, "UTF-8");
    }
<commit_msg>use an array for allowedTags of filterStripTags instead of a string<commit_after><?php namespace Fadion\ValidatorAssistant;

class Filters {

    /**
    * @var array Filters
    */
    protected $filters = array();

    /**
    * @var mixed Inputs
    */
    private $inputs;

    /**
    * Initialize the Filters class.
    *
    * @param  array  $inputs
    * @param  string  $filters
    * @return void
    */
    public function __construct($inputs, $filters)
    {
        $this->inputs = $inputs;
        $this->filters = $filters;
    }

    /**
    * Apply filters to the inputs.
    *
    * @return array
    */
    public function apply()
    {
        $filters = $this->filters;
        $inputs = $this->inputs;

        if (count($filters)) {
            foreach ($filters as $name => $filter) {
                $rules = explode('|', $filter);

                // At least a rule is set and the input
                // field exists.
                if (count($rules) and isset($inputs[$name])) {
                    foreach ($rules as $rule) {
                        $rule = explode(':', $rule);

                        $argument = null;
                        if (isset($rule[1])) {
                            $argument = $rule[1];
                        }

                        $rule = strtolower($rule[0]);
                        $rule = str_replace('_', ' ', $rule);
                        $rule = str_replace(' ', '', ucwords($rule));

                        $method = 'filter'.$rule;

                        // Check if rule is defined as a class method.
                        if (method_exists($this, $method)) {
                            $inputs[$name] = $this->$method($inputs[$name], $argument);
                        }
                    }
                }
            }
        }

        return $inputs;
    }

    /**************
    *   FILTERS   *
    **************/

    /**
    * Trim filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterTrim($value, $argument = null)
    {
        return trim($value, $argument);
    }

    /**
    * Trim filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterLrim($value, $argument = null)
    {
        return ltrim($value, $argument);
    }

    /**
    * Trim filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterRtrim($value, $argument = null)
    {
        return rtrim($value, $argument);
    }

    /**
    * MD5 filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterMd5($value, $argument = null)
    {
        return md5($value);
    }

    /**
    * Sha1 filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterSha1($value, $argument = null)
    {
        return sha1($value);
    }

    /**
    * URL Encode filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterUrlEncode($value, $argument = null)
    {
        return urlencode($value);
    }

    /**
    * URL Decode filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterUrlDecode($value, $argument = null)
    {
        return urldecode($value);
    }

    /**
    * Strip Tags filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterStripTags($value, $argument = null)
    {
        $allowedTags = array('<p>', '<a>', '<b>', '<i>', '<em>', '<strong>', '<img>', '<br>', '<ul>', '<ol>', '<li>', '<span>', '<blockquote>', '<code>', '<sub>', '<sup>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<dd>', '<dl>', '<label>');

        return strip_tags($value, join(null, $allowedTags));
    }

    /**
    * HTMLEntities filter
    *
    * @param string $value
    * @param string $argument
    * @return string
    */
    private function filterHtmlentities($value, $argument = null)
    {
        return htmlentities($value, ENT_QUOTES, "UTF-8");
    }

{'fraction_non_alphanumeric': 0.14862122478214157, 'fraction_numerical': 0.0038199832875731167, 'mean_word_length': 1.6132252027448535, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 65, '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': '604736', 'n_tokens_mistral': 2452, 'n_tokens_neox': 2404, 'n_words': 595}