Convert a rule to an array of all its values.

@param string $rule
@param int    $min
@param int    $max

@return array
484937
protected function parseRule($rule, $min, $max)
    {
        $result = [];

        foreach (explode(',', $rule) as $value) {
            if (preg_match('/^([0-9]+)-([0-9]+)$/', $value, $r)) {
                $result = array_merge($result, range($r[1], $r[2]));
            } elseif (preg_match('/^\*\/([0-9]+)$/', $value, $r)) {
                for ($i = $min; $i <= $max; $i++) {
                    if ($i % $r[1] == 0) {
                        $result[] = $i;
                    }
                }
            } elseif (is_numeric($value)) {
                $result[] = $value;
            }
        }

        return $result;
    }
303728
protected function ruleToArray($rule)
    {
        if ($rule instanceof ConstraintGroup || $rule instanceof Constraint) {
            return $this->constraintToArray($rule);
        }

        return $this->parseConstraint($rule);
    }
960904
public function havingBetween(string $column, int $min, int $max)
    {
        $instance = $this->havingStrategyInstance();

        $instance->havingStrategy()->havingBetween($column, $min, $max);

        return $instance;
    }
646755
function ruleMin($min, $error_message = null) {
        if (!is_numeric($min)) {
            throw new \Exception('Incorrect parameter MIN in rule min');
        }

        return $this->_rule('min:' . $min, $error_message);
    }
425758
public function parse($value, $rule) {
        $rs = $value;

        $ruleFormat = !empty($rule['format']) ? strtolower($rule['format']) : '';
        if ($ruleFormat == 'timestamp') {
            $rs = strtotime($value);
            if ($rs <= 0) {
            	$rs = 0;
            }

            if (isset($rule['min']) && !is_numeric($rule['min'])) {
                $rule['min'] = strtotime($rule['min']);
            }
            if (isset($rule['max']) && !is_numeric($rule['max'])) {
                $rule['max'] = strtotime($rule['max']);
            }

            $rs = $this->filterByRange($rs, $rule);
        }

        return $rs;
    }
281636
protected function parseRule( $rule )
	{
		$parameters = [];

		// example: {rule}:{parameters}
		if( strpos( $rule, ':' ) !== false ) {
			list( $rule, $parameter ) = explode( ':', $rule, 2 );

			// example: {parameter1,parameter2,...}
			$parameters = $this->parseParameters( $rule, $parameter );
		}

		$rule = ucwords( str_replace( ['-', '_'], ' ', trim( $rule )));
		$rule = str_replace( ' ', '', $rule );

		return [ $rule, $parameters ];
	}
583737
protected function resolveRule($rule)
    {

        $validation = [];
        if (is_array($rule)) {
            return $validation;
        }
        switch ($rule) {
            case 'required':
                $validation['required'] = 'required';
                break;
            default:
                if (str_contains($rule, ':') && !str_contains($rule, 'unique')) {
                    list($name, $value) = explode(':', $rule);
                    $validation["data-{$name}length"] = $value;
                }
                break;
        }
        return $validation;
    }
1232010
protected function parseValidationRule($rule)
	{
		$ruleArray = ['name' => '', 'parameters' => []];

		$explodedRule = explode(':', $rule);
		$ruleArray['name'] = array_shift($explodedRule);
		$ruleArray['parameters'] = explode(',', array_shift($explodedRule));

		return $ruleArray;
	}
16959
public function parse($rules)
    {
        $this->rules = $rules;
        $parsed = [];
        foreach ($this->getRules() as $rulesArray) {
            $column = $this->getColumn($rulesArray);
            $attributes = $this->getAttributes($column, $rulesArray);
            $parsed[$column] = $attributes;
        }

        return $parsed;
    }
388275
protected function extractCustomValidationShortName(array $rules)
    {
        $customRules = array_map(function ($rule) {
            $fullname = $this->getCustomRuleFullName($rule);

            if ($this->canHaveUsingCommand($fullname)) {
                $shortName = $this->getCustomRuleShortName($fullname);

                return $this->makeCustomRuleCall($shortName);
            }

            return $this->makeCustomRuleCall($fullname);

        }, $rules);

        return $customRules;
    }
132566
protected function parseRulesArray(array $rules)
    {
        $parsedRules = [];

        $rawRules = (new ValidationRuleParser($this->data))->explode($rules);

        foreach ($rawRules->rules as $attribute => $attributeRules) {
            foreach ($attributeRules as $attributeRule) {
                $parsedRule = $this->parseRuleString($attributeRule);
                if ($parsedRule) {
                    $parsedRules[$attribute][] = $parsedRule;
                }
            }
        }

        return $parsedRules;
    }
73889
public static function getRandom($min,$max){
		if($min === null)
			$min = 0;
		if($max === null)
			$max = 1;
		return mt_rand($min, $max);
	}
842608
public function whereBetween($attribute, $min, $max)
    {
        switch (true) {
            case !is_empty_string($min) && !is_empty_string($max):
                return $this->parseWhere($attribute, 'between', [$min, $max]);

            case !is_empty_string($min):
                return $this->whereGte($attribute, $min);

            case !is_empty_string($max):
                return $this->whereLte($attribute, $min);

            default:
                return $this;
        }
    }
1113338
public function between( $value, $rule )
	{
		if( is_string( $rule ) ){
			$rule = explode( ',', $rule );
		}
		list( $min, $max ) = $rule;
		return $value >= $min && $value <= $max;
	}
699514
private function parseRule($rule)
	{
		if (!is_array($rule) || (count($rule) < 2)) {
			throw new ValidatorException('Invalid declaration of validation rule');
		}

		is_array($rule[0]) || $rule[0] = [$rule[0]];

		if (!is_string($rule[1])) {
			throw new ValidatorException('Validator name: Expected string');
		}

		if (isset($rule[2])) {
			if(!is_array($rule[2])) {
				throw new ValidatorException('Validator options: Expected array');
			}
		} else {
			$rule[2] = [];
		}
		$rule[2] = new ArrayWrapper($rule[2]);

		return $rule;
	}
1035569
public function rule_min( $key, $value, $min )
	{
		return $this->rule_min_num( $key, strlen( $value ), $min );
	}
927902
public function getRuleParams($field, $rule)
    {
        return isset($this->rules[$field][$rule]) ? (array) $this->rules[$field][$rule] : array();
    }