DetectTypeTrait
Trait DetectTypeTrait.
Detect the type of data.
Table of Contents
- detectType() : string
- Detect the type of data that is input .
- isArray() : bool
- Validate a variable is an array.
- isBool() : bool
- Validate a variable is boolean.
- isEmpty() : bool
- Validate a variable is empty.
- isFloat() : bool
- Validate a variable is float.
- isHtml() : bool
- Validate a variable is HTML.
- isInt() : bool
- Validate a variable is integer.
- isJson() : bool
- Validate a variable is JSON.
- isXml() : bool
- Validate a variable is XML.
Methods
detectType()
Detect the type of data that is input .
public
detectType(mixed $data) : string
Parameters
- $data : mixed
-
Data to test.
Return values
string —The data type.
isArray()
Validate a variable is an array.
public
isArray(mixed $var) : bool
Parameters
- $var : mixed
-
Variable to test.
Return values
bool —isBool()
Validate a variable is boolean.
public
isBool(mixed $var) : bool
Parameters
- $var : mixed
-
Variable to test.
Return values
bool —isEmpty()
Validate a variable is empty.
public
isEmpty(mixed $var) : bool
Parameters
- $var : mixed
-
Variable to test.
Return values
bool —isFloat()
Validate a variable is float.
public
isFloat(mixed $var) : bool
Parameters
- $var : mixed
-
Variable to test.
Return values
bool —isHtml()
Validate a variable is HTML.
public
isHtml(mixed $var) : bool
Parameters
- $var : mixed
-
Variable to test.
Return values
bool —isInt()
Validate a variable is integer.
public
isInt(mixed $var) : bool
Parameters
- $var : mixed
-
Variable to test.
Return values
bool —isJson()
Validate a variable is JSON.
public
isJson(mixed $var) : bool
Parameters
- $var : mixed
-
Variable to test.
Return values
bool —isXml()
Validate a variable is XML.
public
isXml(mixed $var) : bool
Parameters
- $var : mixed
-
Variable to test.