PHP Class Lazer\Classes\Helpers\Validate

Author: Grzegorz Kuźnik
Show file Open project: greg0/lazer-database Class Usage Examples

Public Methods

Method Description
arrToLower ( array $array ) : array Change keys and values case to lower
exists ( ) : boolean Checking that Table and Config exists and throw exceptions if not
field ( string $name ) : boolean Checking that typed field really exist in table
fields ( array $fields ) : boolean Checking that typed fields really exist in table
filter ( array $fields ) : array Delete ID field from arrays
isNumeric ( string $type ) : boolean Checking that field type is numeric
relation ( string $local, string $foreign ) : boolean Checking that relation between tables exists
relationType ( string $type ) : boolean Checking that relation type is correct
table ( string $name ) : Validate Table name
type ( string $name, mixed $value ) : boolean Checking that typed field have correct type of value
types ( array $types ) : boolean Checking that types from array matching with [boolean, integer, string, double]

Method Details

arrToLower() public static method

Change keys and values case to lower
public static arrToLower ( array $array ) : array
$array array
return array

exists() public method

Checking that Table and Config exists and throw exceptions if not
public exists ( ) : boolean
return boolean

field() public method

Checking that typed field really exist in table
public field ( string $name ) : boolean
$name string
return boolean

fields() public method

Checking that typed fields really exist in table
public fields ( array $fields ) : boolean
$fields array Indexed array
return boolean

filter() public static method

Delete ID field from arrays
public static filter ( array $fields ) : array
$fields array
return array Fields without ID

isNumeric() public static method

Checking that field type is numeric
public static isNumeric ( string $type ) : boolean
$type string
return boolean

relation() public static method

Checking that relation between tables exists
public static relation ( string $local, string $foreign ) : boolean
$local string local table
$foreign string related table
return boolean relation exists

relationType() public static method

Checking that relation type is correct
public static relationType ( string $type ) : boolean
$type string
return boolean relation type

table() public static method

Table name
public static table ( string $name ) : Validate
$name string
return Validate

type() public method

Checking that typed field have correct type of value
public type ( string $name, mixed $value ) : boolean
$name string
$value mixed
return boolean

types() public static method

Checking that types from array matching with [boolean, integer, string, double]
public static types ( array $types ) : boolean
$types array Indexed array
return boolean