_empty()
_validation_exact_length()
_validation_match_collection()
_validation_match_field()
_validation_match_pattern()
_validation_match_value()
_validation_max_length()
_validation_min_length()
_validation_numeric_between()
_validation_numeric_max()
_validation_numeric_min()
_validation_required()
_validation_required_with()
_validation_valid_date()
_validation_valid_email()
_validation_valid_emails()
_validation_valid_ip()
_validation_valid_string()
_validation_valid_url()
active()
active_field()
add()
add_callable()
add_field()
add_model()
callables()
error()
error_message()
field()
fieldset()
forge()
get_message()
input()
instance()
remove_callable()
run()
set_message()
show_errors()
validated()
__construct()
_find_rule()
_run_rule()
add_error()
set_active()
set_active_field()
$active
$active_field
$callables
$error_messages
$errors
$fieldset
$global_input_fallback
$input
$validated
Validation
Static object to allow static usage of validation through singleton.
| package | Fuel |
|---|---|
| subpackage | Core |
| category | Core |
_empty(mixed $val) : bool
mixed
bool_validation_exact_length(string $val, int $length) : bool
string
int
bool_validation_match_collection(string $val, array $collection, bool $strict) : bool
string
array
boolwhether to do type comparison
bool_validation_match_field(string $val, string $field) : bool
string
string
\Validation_Error |
|---|
bool_validation_match_pattern(string $val, string $pattern) : bool
string
stringa PRCE regex pattern
bool_validation_match_value(mixed $val, mixed $compare, bool $strict) : bool
mixed
mixed
boolwhether to do type comparison
bool_validation_max_length(string $val, int $length) : bool
string
int
bool_validation_min_length(string $val, int $length) : bool
string
int
bool_validation_numeric_between(string | float | int $val, float | int $min_val, float | int $max_val) : bool
stringfloatint
floatint
floatint
bool_validation_numeric_max(string | float | int $val, float | int $max_val) : bool
stringfloatint
floatint
bool_validation_numeric_min(string | float | int $val, float | int $min_val) : bool
stringfloatint
floatint
bool_validation_required(mixed $val) : bool
Value may not be empty
mixed
bool_validation_required_with(mixed $val, string $field) : bool
mixed
string
\Validation_Error |
|---|
bool_validation_valid_date(string $val, string $format, bool $strict) : bool
When a format is passed it will make sure the date will be in that specific format if validated
string
stringThe format used at the time of a validation
boolWhether validation checks strict
bool_validation_valid_email(string $val) : bool
string
bool_validation_valid_emails(string $val, string $separator) : bool
string
string
bool_validation_valid_ip(string $val, string $flag) : bool
string
stringipv4|ipv6
bool_validation_valid_string(string $val, string | array $flags) : bool
string
stringarrayeither a named filter or combination of flags
bool_validation_valid_url(string $val) : bool
string
boolactive_field()
add(string $name, string $label, array $attributes, array $rules) : \Fuel\Core\Fieldset_Field
string
string
array
array
add_callable(string | Object $class) : \Fuel\Core\Validation
Adds an object for which you don't need to write a full callback, just the method as a string will do. This also allows for overwriting functionality from this object because the new class is prepended.
stringObjectClassname or object
\Fuel\Core\Validationthis, to allow chainingadd_field(string $name, string $label, string $rules) : \Fuel\Core\Fieldset_Field
| depricated | Remove in v2.0, passing rules as string is to be removed use add() instead |
|---|
stringField name
stringField label
stringRules as a piped string
\Fuel\Core\Fieldset_Field$this to allow chainingadd_model(string | Object $class, array | Object $instance, string $method) : \Fuel\Core\Validation
callables() : array
arrayerror(string $field, mixed $default) : \Fuel\Core\Validation_Error | array
Return specific error or all errors thrown during validation
stringfieldname
mixedvalue to return when not validated
\Fuel\Core\Validation_Errorarraythe validation error object or full array of error objectsfield(string | null $name, bool $flatten) : \Fuel\Core\Fieldset_Field | false
forge(string $fieldset) : \Fuel\Core\Validation
stringThe name or instance of the Fieldset to link to
input(string $key, mixed $default) : mixed | array
string
mixed
mixedarraythe input value or full input values arrayinstance($name)
remove_callable($class)
run(array $input, bool $allow_partial, $temp_callables) : bool
Performs validation with current fieldset and on given input, will try POST when input wasn't given.
arrayinput that overwrites POST values
boolwill skip validation of values it can't find or are null
bool$temp_callables whether validation succeededshow_errors(array $options) : string
Returns all errors in a list or with set markup from $options param
arrayuses keys open_list, close_list, open_error, close_error /p>
stringvalidated(string $field, mixed $default) : mixed | array
Returns specific validated value or all validated field=>value pairs
stringfieldname
mixedvalue to return when not validated
mixedarraythe validated value or full validated values array__construct($fieldset)
_find_rule(string | array $callback) : array | bool
stringarrayshort rule to be called on Validation callables array or full callback
arrayboolrule array or false when it fails to find something callable_run_rule(callback $rule, mixed $value, array $params, array $field)
Performs a single rule on a field and its value
callback
mixedValue by reference, will be edited
arrayExtra parameters
arrayValidation field description
\Validation_Error |
|---|
add_error(string $name, \Fuel\Core\Validation_Error $error) : \Fuel\Core\Validation
Adds an error for a given field.
stringfield name for which to set the error
\Fuel\Core\Validationthis, to allow chainingset_active($instance)
set_active_field($instance)
$active : \Fuel\Core\Validation
$active_field : \Fuel\Core\Fieldset_Field
$callables : array
$errors : array
$global_input_fallback : bool
$input : array
$validated : array