<commit_before>
namespace Ice\Validation;

use Ice\Validation;

/**
 * Validator is a base class for validators.
 *
 * @package     Ice/Validation
 * @category    Security
 * @author      <NAME>
 * @copyright   (c) 2014-2018 Ice Team
 * @license     http://iceframework.org/license
 */
abstract class Validator
{
    
    protected options = [];

    const ALL = 0;
    const NUMERIC = 1;
    const STRINGS = 2;

    /**
     * Validator constructor.
     *
     * @param array options
     */
    public function __construct(array options = [])
    {
        let this->options = options;
    }

    /**
     * Validate the validator
     *
     * @param Validation validation
     * @param string field
     */
    public abstract function validate(<Validation> validation, string! field);

    /**
     * Whether or not an option exists by key.
     *
     * @param string key The option key
     * @return boolean
     */
    public function has(var key) -> boolean
    {
        return isset this->options[key];
    }

    /**
     * Retrieve a single option.
     *
     * @param string key The data key
     * @param mixed defaultValue The value to return if data key does not exist
     * @return mixed
     */
    public function get(var key, var defaultValue = null)
    {
        var value;

        if fetch value, this->options[key] {
            return value;
        }

        return defaultValue;
    }

    /**
     * Assigns a value to the specified option.
     *
     * @param string key The data key
     * @param mixed value
     * @return void
     */
    public function set(var key, var value)
    {
        let this->options[key] = value;
    }<commit_msg>Always return this from setXxx<commit_after>
namespace Ice\Validation;

use Ice\Validation;

/**
 * Validator is a base class for validators.
 *
 * @package     Ice/Validation
 * @category    Security
 * @author      Ice Team
 * @copyright   (c) 2014-2018 Ice Team
 * @license     http://iceframework.org/license
 */
abstract class Validator
{
    
    protected options = [];

    const ALL = 0;
    const NUMERIC = 1;
    const STRINGS = 2;

    /**
     * Validator constructor.
     *
     * @param array options
     */
    public function __construct(array options = [])
    {
        let this->options = options;
    }

    /**
     * Validate the validator
     *
     * @param Validation validation
     * @param string field
     */
    public abstract function validate(<Validation> validation, string! field);

    /**
     * Whether or not an option exists by key.
     *
     * @param string key The option key
     * @return boolean
     */
    public function has(var key) -> boolean
    {
        return isset this->options[key];
    }

    /**
     * Retrieve a single option.
     *
     * @param string key The data key
     * @param mixed defaultValue The value to return if data key does not exist
     * @return mixed
     */
    public function get(var key, var defaultValue = null)
    {
        var value;

        if fetch value, this->options[key] {
            return value;
        }

        return defaultValue;
    }

    /**
     * Assigns a value to the specified option.
     *
     * @param string key The data key
     * @param mixed value
     * @return object Validator
     */
    public function set(var key, var value)
    {
        let this->options[key] = value;
        
        return this;
    }
{'fraction_non_alphanumeric': 0.09547445255474453, 'fraction_numerical': 0.006423357664233576, 'mean_word_length': 1.898477157360406, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 16, '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': '5602057', 'n_tokens_mistral': 990, 'n_tokens_neox': 949, 'n_words': 328}