Overtrue\Validation\Validator::getRule PHP Method

getRule() protected method

Get a rule and its parameters for a given attribute.
protected getRule ( string $attribute, string | array $rules ) : array | null
$attribute string
$rules string | array
return array | null
    protected function getRule($attribute, $rules)
    {
        if (!array_key_exists($attribute, $this->rules)) {
            return;
        }
        $rules = (array) $rules;
        foreach ($this->rules[$attribute] as $rule) {
            list($rule, $parameters) = $this->parseRule($rule);
            if (in_array($rule, $rules, true)) {
                return [$rule, $parameters];
            }
        }
    }
Validator