<commit_before><?php

namespace Acelot\Validation\Validator;

use Acelot\Validation\Validator;

class IntegerRange extends Validator
{
    /**
     * @var int
     */
    protected $min;

    /**
     * @var int
     */
    protected $max;

    /**
     * @var string
     */
    protected $template = 'Field value must be in the range from {min} to {max}';

    /**
     * @param int $min
     * @param int $max
     */
    public function __construct($min, $max)
    {
        if (!is_int($min) || !is_int($max)) {
            throw new \InvalidArgumentException('Arguments must be an integers');
        }

        $this->min = $min;
        $this->max = $max;
    }

    /**
     * @return boolean
     */
    public function validate($value, $wholeData = null)
    {
        $value = intval($value);

        return $value >= $this->min && $value <= $this->max;
    }
}<commit_msg>IntegerRange supports step<commit_after><?php

namespace Acelot\Validation\Validator;

use Acelot\Validation\Validator;

class IntegerRange extends Validator
{
    /**
     * @var int
     */
    protected $min;

    /**
     * @var int
     */
    protected $max;

    /**
     * @var int
     */
    protected $step;

    /**
     * @var string
     */
    protected $template = 'Field value must be in the range from {min} to {max}';

    /**
     * @param int $min
     * @param int $max
     */
    public function __construct($min, $max, $step = 1)
    {
        if (!is_int($min) || !is_int($max) || !is_int($step)) {
            throw new \InvalidArgumentException('Arguments must be an integers');
        }

        $this->min = $min;
        $this->max = $max;
        $this->step = $step;
    }

    /**
     * @return boolean
     */
    public function validate($value, $wholeData = null)
    {
        $value = intval($value);

        return in_array($value, range($this->min, $this->max, $this->step));
    }
}
{'fraction_non_alphanumeric': 0.15316257187663357, 'fraction_numerical': 0.0005227391531625719, 'mean_word_length': 1.9537037037037037, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 14, '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': '3285673', 'n_tokens_mistral': 613, 'n_tokens_neox': 593, 'n_words': 151}