프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$customRules | string[] | Contains a list of any custom validation rules | |
$fields | Fuel\Validation\FieldInterface[] | Contains a list of fields to be validated | |
$lastAddedField | Fuel\Validation\FieldInterface | Keeps track of the last field added for magic method chaining | |
$lastAddedRule | Fuel\Validation\RuleInterface | Keeps track of the last rule added for message setting | |
$messages | string[] | ||
$ruleNamespace | string | Default namespace to look for rules in when a rule is not known |
메소드 | 설명 | |
---|---|---|
__call ( string $name, array $arguments ) | Allows validation rules to be dynamically added using method chaining. | |
addCustomRule ( string $name, string $class ) | Adds custom validation rules and allows for core rules to be overridden. | |
addField ( string | Fuel\Validation\FieldInterface $field, string $label = null ) | Adds a new field to the validation object | |
addRule ( string | Fuel\Validation\FieldInterface $field, Fuel\Validation\RuleInterface $rule ) | Adds a rule that can be used to validate a field | |
createRuleInstance ( string $name, mixed $parameters = [] ) : Fuel\Validation\RuleInterface | Creates an instance of the given rule name | |
getField ( $name ) : Fuel\Validation\FieldInterface | Returns the given field | |
getFieldRules ( string $fieldName ) : Fuel\Validation\RuleInterface[] | ||
getGlobalMessage ( string $ruleName ) : null | string | Gets the global message set for a rule | |
removeGlobalMessage ( string $ruleName ) | Removes a global rule message | |
run ( array $data, Fuel\Validation\ResultInterface $result = null ) : Fuel\Validation\ResultInterface | Takes an array of data and validates that against the assigned rules. | |
runField ( string $field, array $data, Fuel\Validation\ResultInterface $result = null ) : Fuel\Validation\ResultInterface | Takes a field name and an array of data and validates the field against the assigned rules. | |
setGlobalMessage ( string $ruleName, string | null $message ) | Sets a custom message for all fields of the given type that are created after the message has been set. | |
setGlobalMessages ( string[] $messages ) | Sets custom messages for one or more rules. Setting the value to "null" will remove the message | |
setMessage ( string $message ) | Sets the failure message for the last added rule |
메소드 | 설명 | |
---|---|---|
buildMessage ( Fuel\Validation\FieldInterface $field, Fuel\Validation\RuleInterface $rule, $value ) : string | Gets a Rule's message and processes that with various tokens | |
getRuleClassName ( string $name ) : string | Returns the full class name for the given validation rule | |
processMessageTokens ( array $tokens, string $message ) : string | Replaces any {} tokens with the matching value from $tokens. | |
validateField ( string $field, mixed[] $data, Fuel\Validation\ResultInterface $result ) : boolean | Validates a single field |
public addCustomRule ( string $name, string $class ) | ||
$name | string | |
$class | string |
protected buildMessage ( Fuel\Validation\FieldInterface $field, Fuel\Validation\RuleInterface $rule, $value ) : string | ||
$field | Fuel\Validation\FieldInterface | |
$rule | Fuel\Validation\RuleInterface | |
리턴 | string |
public createRuleInstance ( string $name, mixed $parameters = [] ) : Fuel\Validation\RuleInterface | ||
$name | string | |
$parameters | mixed | |
리턴 | Fuel\Validation\RuleInterface |
public getField ( $name ) : Fuel\Validation\FieldInterface | ||
$name | ||
리턴 | Fuel\Validation\FieldInterface |
public getFieldRules ( string $fieldName ) : Fuel\Validation\RuleInterface[] | ||
$fieldName | string | |
리턴 | Fuel\Validation\RuleInterface[] |
protected getRuleClassName ( string $name ) : string | ||
$name | string | |
리턴 | string |
public removeGlobalMessage ( string $ruleName ) | ||
$ruleName | string |
public setGlobalMessages ( string[] $messages ) | ||
$messages | string[] |
public setMessage ( string $message ) | ||
$message | string |
protected validateField ( string $field, mixed[] $data, Fuel\Validation\ResultInterface $result ) : boolean | ||
$field | string | |
$data | mixed[] | |
$result | Fuel\Validation\ResultInterface | |
리턴 | boolean |
protected string[] $customRules | ||
리턴 | string[] |
protected FieldInterface[],Fuel\Validation $fields | ||
리턴 | Fuel\Validation\FieldInterface[] |
protected FieldInterface,Fuel\Validation $lastAddedField | ||
리턴 | Fuel\Validation\FieldInterface |
protected RuleInterface,Fuel\Validation $lastAddedRule | ||
리턴 | Fuel\Validation\RuleInterface |
protected string $ruleNamespace | ||
리턴 | string |