Agregar una regla de validacion que luego sera validada
@param string $name
@param type $value
@param array[string] $rules
515496
public function add_rule($name, $value, $rules){
        $this->fieldsState[$name] = array(
			'name'			=> $name,
			'value'			=> $value,
			'rules'			=> explode('|', $rules),
                        'valid'                 => TRUE,
                        'message'               => NULL
        );
    }
163969
public function bind_value( string $name, $value, $data_type = false ) {
		$this->values_to_bind[ $name ] = array(
			'value'     => $value,
			'data_type' => $data_type,
		);
	}
891082
protected function validateUsingCustomRule($attribute, $value, $rule)
    {
        if (! $rule->passes($attribute, $value)) {
            $this->failedRules[$attribute][get_class($rule)] = [];

            $messages = (array) $rule->message();

            foreach ($messages as $message) {
                $this->messages->add($attribute, $this->makeReplacements(
                    $message, $attribute, get_class($rule), []
                ));
            }
        }
    }
1207407
protected function formatEnumValue($value, $rule) {
        if (!in_array($value, $rule['range'])) {
            $message = isset($rule['message'])
                ? \PhalApi\T($rule['message'])
                : \PhalApi\T('{name} should be in {range}, but now {name} = {value}', 
                    array('name' => $rule['name'], 'range' => implode('/', $rule['range']), 'value' => $value));
            throw new BadRequestException($message);
        }
    }
182749
private function ___set($name, $value)
    {
        /**
         * @var PropertyContract $meta
         */
        $meta = self::$schema->getPropertyEntryByIdentifier($name);

        if (!$meta) {
            return;
        }

        $isRequired = $meta->getBehavior()->isRequired();

        if (is_null($value) && $isRequired) {
            throw new Exception("Propriedade obrigatória não pode ser nula [ " . $name . " ]", 400);
        }

        if ($value) {
            $value = Validator::make(self::$schema)->validate($name, $value);

            if ($meta->getAllowedValues()) {

                if (!in_array($value, $meta->getAllowedValues())) {

                    $msg = "Valor [ {$value} ] para [ {$name} ] esta fora do intervalo permitido ";
                    $msg .= '[ ' . implode(',', $meta->getAllowedValues()) . ' ]';

                    throw new Exception($msg, 400);
                }
            }
        }

        if (method_exists($this, 'set' . ucfirst($name))) {
            $this->{'set' . ucfirst($name)}($value);
        } else {
            $this->{$name} = $value;
        }
    }
478569
protected function walkRuleChain($value, $rules)
    {
        foreach ($rules as $rule) {
            $filter = $this->filterLoader->getFilterForRule($rule);
            $value = $filter->apply($rule, $value);
        }

        return $value;
    }
307572
protected function validate(array $rules, $values = null, array $customAttrs = [])
    {
        // Se os valores forem nulos, buscar no request
        if (is_null($values)) {
            $values = request()->all();
        }

        // Validar valores pela regra
        return Validator::validate($values, $rules, $customAttrs);
    }
184514
public function validate($data, array $rules, $context = null): ValidatorInterface
    {
        return new Validator($data, $rules, $context, $this);
    }
695735
public function storeRule($field, $name, $rule = null)
    {
        self::validateFieldName($field);
        if (is_array($name)) {
            foreach ($name as $k => $v) {
                $this->storeRule($field, $k, $v);
            }

            return;
        }
        if ($rule === null && is_string($name)) {
            $rule = $name;
            $name = null;
        }
        if (empty($name) || !is_string($name)) {
            $name = Util::pathOfUrl(URL::current(), function ($e) use ($field) {
                throw new LaravelSmsException("Expected a name for the dynamic rule which belongs to field `$field`.");
            });
        }
        $allRules = $this->retrieveRules($field);
        $allRules[$name] = $rule;
        $key = $this->generateKey(self::DYNAMIC_RULE_KEY, $field);
        self::storage()->set($key, $allRules);
    }
283528
public function rule($name, $rule = '')
    {
        if (is_array($name)) {
            $this->rule = $name + $this->rule;
            if (is_array($rule)) {
                $this->field = array_merge($this->field, $rule);
            }
        } else {
            $this->rule[$name] = $rule;
        }

        return $this;
    }
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;
	}
178504
protected function link($name, $value){
        //Si no se completo no se valida
        if(! $this->isComplete($value)){
            return TRUE;
        }
        if(! filter_var($value, FILTER_VALIDATE_URL)){
            $this->add_message($name, 'link');
            return FALSE;
        }
        return TRUE;
    }
703564
public function setRules(array $rules): void
    {
        foreach ($rules as $key => $fields) {
            foreach ($fields as $fieldName => $fieldOptions) {
                // nested?
                @ $fieldType = $fieldOptions['type'];
                if ($fieldType == self::TYPE_ARRAY) {
                    @ $fieldSpec = $fieldOptions['spec'];
                    if (empty($fieldSpec)) {
                        throw new ValidationException(
                            "For array types, 'spec' field must be a non-empty array (field: {$fieldName})");
                    }
                    foreach ((array) $fieldSpec as $fieldSpecFieldName => $fieldSpecFieldOptions) {
                        $this->rules[$key][$fieldName][$fieldSpecFieldName] = new ValidationRule(
                            $fieldSpecFieldName, $fieldSpecFieldOptions
                        );
                    }
                } else {
                    $this->rules[$key][$fieldName] = new ValidationRule($fieldName, $fieldOptions);
                }
            }
        }
    }
12848
public function is(array $values, array $rules)
    {
        try {
            $this->execute($values, $rules);
        } catch (\Exception $ex) {
            return false;
        }

        return true;
    }
111928
public function checkRule($value, $rules)
    {
        if ($rules instanceof \Closure) {
            return call_user_func_array($rules, [$value]);
        } elseif ($rules instanceof ValidateRule) {
            $rules = $rules->getRule();
        } elseif (is_string($rules)) {
            $rules = explode('|', $rules);
        }

        foreach ($rules as $key => $rule) {
            if ($rule instanceof \Closure) {
                $result = call_user_func_array($rule, [$value]);
            } else {
                // 判断验证类型
                list($type, $rule) = $this->getValidateType($key, $rule);

                $callback = isset(self::$type[$type]) ? self::$type[$type] : [$this, $type];

                $result = call_user_func_array($callback, [$value, $rule]);
            }

            if (true !== $result) {
                return $result;
            }
        }

        return true;
    }
521416
protected function email($name, $value){
        //Si no se completo no se valida
        if(! $this->isComplete($value)){
            return TRUE;
        }
        if(! filter_var($value, FILTER_VALIDATE_EMAIL)){
            $this->add_message($name, 'email');
            return FALSE;
        }
        return TRUE;
    }
763150
protected function validate(array $data, array $rules = null): void
    {
        $validator = $this->validatorFactory->make($data, $rules ?? $this->getValidationRules());
        if ($validator->fails()) {
            throw new ValidationException($validator);
        }
    }