less-than:<another_field>

@param \MadeSimple\Validator\Validator $validator
@param array $data
@param string $pattern
@param string $rule
@param array  $parameters
348125
public static function lessThan(Validator $validator, $data, $pattern, $rule, $parameters)
    {
        $upperBound = Validator::getValue($data, $parameters[0]);
        if (null === $upperBound) {
            return;
        }
        foreach (Validator::getValues($data, $pattern) as $attribute => $value) {
            if (null === $value || empty($value)) {
                continue;
            }
            if ($value < $upperBound) {
                continue;
            }

            $validator->addError($attribute, $rule, [':value' => $value]);
        }
    }
699183
public function validate(array $data = [], array $rules = [], array $messages = [])
    {
        $this->prepareRecord($data, $rules, $messages);

        return $this->validateRecord();
    }
729587
protected function validateEmail($value, string $parameter, array $args = [], array $rules = null, array $context = null): ?string
    {
        //$value = $this->getValue($parameter);

        if ($value === null) {
            return null;
        }

        if (!is_scalar($value)) {
            return Message::getMessage(Message::PRIMITIVE, [
                'param' => $parameter
            ]);
        }

        $value = trim((string)$value);

        if ($value === '') {
            return null;
        }

        if (!Validate::isEmail($value)) {
            return Message::getMessage(Message::EMAIL, [
                'param' => $parameter,
                'value' => $value
            ]);
        }

        return null;
    }
936826
public static function make(array $data, array $rules)
    {
        self::$validator = new V([]);
        self::$validator->labels($data);

        foreach ($rules as $rule => $columns) {
            if (is_string($columns)) {
                $columns = self::separte($columns);
            } else {
                $columns = $columns;
            }

            $value = self::getValue($rule);

            self::$validator->rule($value['rule'], $columns, $value['value']);
        }

        return new ValidationResult(self::$validator);
    }
1091187
public function validate(array $data, $rules = null, $custom = false)
    {
        if (!$custom) {
            $rules = $this->rules($rules);
        }

        return $this->validator->make($data, $rules);
    }
129545
private static function applyValidatorRules($validator, array &$rules)
    {
        $validatorRule = ValidatorRule::getInstance();
        foreach ($rules as $rule) {
            list($functionName, $arguments) = $validatorRule->parseRule($validator, $rule);
            $validator = \call_user_func_array([$validator, $functionName], $arguments);
        }

        return $validator;
    }
1367247
public static function required(Validator $validator, $data, $pattern, $rule)
    {
        // Check pattern is present
        if (!ArrDots::has($data, $pattern, $validator::WILD)) {
            $validator->addError($pattern, $rule);
        }

        // Check value is not null
        foreach (Validator::getValues($data, $pattern) as $attribute => $value) {
            if (null !== $value) {
                continue;
            }

            $validator->addError($attribute, $rule);
        }
    }
940794
private function validateData($rules, $data) {
		$errors = [];
		foreach ($rules as $field => $rule) {
			$valid = $this->validateField($field, $data, $rule);
			if ($valid !== true) {
				$errors[ $field ] = $valid;
			}
		}
		if (!empty($errors)) {
			throw new ValidateException($errors);
		}

		return true;
	}
184514
public function validate($data, array $rules, $context = null): ValidatorInterface
    {
        return new Validator($data, $rules, $context, $this);
    }
508421
public function validateData(array $data, array $rules, array $messages)
    {
        if ($rules) {
            $this->customValidator->setData($data);
            $this->customValidator->setRules($rules);
            $this->customValidator->setCustomMessages($messages);

            //if the validator fails, kick back the errors
            if ($this->customValidator->fails()) {
                return implode('. ', $this->customValidator->messages()->all());
            }
        }

        return true;
    }
509755
private function tryValidateData(
        array $data,
        array $rules,
        Closure $validationFailed,
        array $messages = [],
        array $customAttributes = []
    ) {
        $validator = $this->createValidator($data, $rules, $messages, $customAttributes);

        if ($validator->fails()) {
            call_user_func($validationFailed, $validator->errors()->getMessages());
        }
    }
134441
protected function validate($attribute, $rule)
	{
		list($rule, $parameters) = $this->parseRule($rule);

		if ($rule == '') return;

		// We will get the value for the given attribute from the array of data and then
		// verify that the attribute is indeed validatable. Unless the rule implies
		// that the attribute is required, rules are not run for missing values.
		$value = $this->getValue($attribute);

		$validatable = $this->isValidatable($rule, $attribute, $value);

		$method = "validate{$rule}";

		if ($validatable && ! $this->$method($attribute, $value, $parameters, $this))
		{
			$this->addFailure($attribute, $rule, $parameters);
		}
	}
499960
protected function useValidator(Validator $validator)
    {
        if ($validator !== $this->validator9) {
            return true;

        }
        $set1 = substr($this->account, 0, 2);
        $set2 = substr($this->account, 0, 3);
        return ($set1 >= 51  && $set1 <= 59)
            || ($set2 >= 901 && $set2 <= 910);
    }
24988
public function execute()
    {
        $to_compare_with = func_get_arg(0);
        $mode = func_num_args() == 1 ? '=' : func_get_arg(1);
        
        $modes = [
            '=',
            '>',
            '<',
            '>=',
            '<='
        ];
        
        if (! in_array($mode, $modes)) {
            Throw new ValidatorException(sprintf('Parameter "%s" not allowed', $mode), 1001);
        }
        
        switch ($mode) {
            case '=':
                $result = $this->value == $to_compare_with;
                break;
            
            case '>':
                $result = $this->value > $to_compare_with;
                break;
            
            case '<':
                $result = $this->value < $to_compare_with;
                break;
            
            case '>=':
                $result = $this->value >= $to_compare_with;
                break;
            
            case '<=':
                $result = $this->value <= $to_compare_with;
                break;
        }
        
        if (! $result) {
            $this->msg = [
                'validator.rule.compare',
                [
                    $this->value,
                    $to_compare_with,
                    $mode
                ]
            ];
        }
    }
1173864
public static function email(Validator $validator, $data, $pattern, $rule)
    {
        foreach (Validator::getValues($data, $pattern) as $attribute => $value) {
            if (null === $value || empty($value)) {
                continue;
            }
            if (false !== filter_var($value, FILTER_VALIDATE_EMAIL)) {
                continue;
            }

            $validator->addError($attribute, $rule);
        }
    }
1169667
public function rule($rule, $fields, ...$params)
    {
        if (\is_callable($rule)
            && !(\is_string($rule) && $this->hasValidator($rule))
        ) {
            $name = $this->getUniqueRuleName($fields);
            $message = $params[0] ?? null;
            $this->addInstanceRule($name, $rule, $message);
            $rule = $name;
        }

        $errors = $this->getRules();
        if (!isset($errors[$rule])) {
            $ruleMethod = 'validate' . \ucfirst($rule);
            if (!\method_exists($this, $ruleMethod)) {
                throw new \InvalidArgumentException("Rule '" . $rule . "' has not been registered with " . __CLASS__ . "::addRule().");
            }
        }

        // Ensure rule has an accompanying message
        $messages = $this->getRuleMessages();
        $message = $messages[$rule] ?? self::ERROR_DEFAULT;

        // Ensure message contains field label
        if (\strpos($message, '{field}') === false) {
            $message = '{field} ' . $message;
        }

        $this->_validations[] = [
            'rule' => $rule,
            'fields' => (array) $fields,
            'params' => (array) $params,
            'message' => '{field} ' . $message,
            'skip' => self::SKIP_CONTINUE,
        ];

        return $this;
    }
290809
public function validateConfig(array $rules, array $configData)
    {
        $validator = $this->createNew(Validator::class);
        
        if ($validator->isValid($rules, $configData) == false) {
            throw new DataValidationException('The config is invalid: ' . print_r($validator->getErrors(), 1));
        }
    }