Validator

package

Default

Methods

__construct

__construct( $validation = array(),  $required = array(),  $sanatation = array()) 

Arguments

$validation

$required

$sanatation

Adds an error to the errors array.

addError( $field, string $type = 'string') 

Arguments

$field

$type

string

Return corrects data

getData() : array

Response

array

Return errors

getErrors() : array

Response

array

Sanatizes an array of items according to the $this->sanatation

sanatize(array $items) : mixed

example: $sanatation = array('fieldname', 'otherfieldname'=>'float');

Arguments

$items

array

Response

mixed

Sanatize a single var according to $type.

sanatizeItem( $var,  $type) : mixed
static

Allows for static calling to allow simple sanatization

Arguments

$var

$type

Response

mixed

Validates an array of items (if needed) and returns true or false

validate(array $items) : boolean

Arguments

$items

array

Response

boolean

Validates a single var according to $type.

validateItem( $var,  $type) : boolean
static

Allows for static calling to allow simple validation.

Arguments

$var

$type

Response

boolean

Properties

expression

expression : 
static

Type(s)

validation

validation : 

Type(s)

sanatation

sanatation : 

Type(s)

required

required : 

Type(s)

errors

errors : 

Type(s)

corrects

corrects : 

Type(s)

fields

fields : 

Type(s)