_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
bool
whether 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
string
a PRCE regex pattern
bool
_validation_match_value(mixed $val, mixed $compare, bool $strict) : bool
mixed
mixed
bool
whether 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
string
float
int
float
int
float
int
bool
_validation_numeric_max(string | float | int $val, float | int $max_val) : bool
string
float
int
float
int
bool
_validation_numeric_min(string | float | int $val, float | int $min_val) : bool
string
float
int
float
int
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
string
The format used at the time of a validation
bool
Whether 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
string
ipv4|ipv6
bool
_validation_valid_string(string $val, string | array $flags) : bool
string
string
array
either a named filter or combination of flags
bool
_validation_valid_url(string $val) : bool
string
bool
active_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.
string
Object
Classname or object
\Fuel\Core\Validation
this, 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 |
---|
string
Field name
string
Field label
string
Rules 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
array
error(string $field, mixed $default) : \Fuel\Core\Validation_Error | array
Return specific error or all errors thrown during validation
string
fieldname
mixed
value to return when not validated
\Fuel\Core\Validation_Error
array
the 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
string
The name or instance of the Fieldset to link to
input(string $key, mixed $default) : mixed | array
string
mixed
mixed
array
the 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.
array
input that overwrites POST values
bool
will 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
array
uses keys open_list, close_list, open_error, close_error /p>
string
validated(string $field, mixed $default) : mixed | array
Returns specific validated value or all validated field=>value pairs
string
fieldname
mixed
value to return when not validated
mixed
array
the validated value or full validated values array__construct($fieldset)
_find_rule(string | array $callback) : array | bool
string
array
short rule to be called on Validation callables array or full callback
array
bool
rule 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
mixed
Value by reference, will be edited
array
Extra parameters
array
Validation field description
\Validation_Error |
---|
add_error(string $name, \Fuel\Core\Validation_Error $error) : \Fuel\Core\Validation
Adds an error for a given field.
string
field name for which to set the error
\Fuel\Core\Validation
this, 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