Methods summary
public
|
|
public
|
|
public
HRC
|
#
newInstance( )
Clones the current object, runs the reset() method and returns the object
Clones the current object, runs the reset() method and returns the object
Returns
HRC
the newly created/cloned object
|
public static
boolean
|
#
cmp( type $x, type $y, type $operator = "==" )
Compares two operands with a specified operator
Compares two operands with a specified operator
Parameters
- $x
type $x operand
- $y
type $y operand
- $operator
type $operator string representation of comparison operator. Supported are: "==",
"===", "!=", "!==", ">", ">=", "<", "<="
Returns
boolean the comparison result; If operator is not supported, NULL
|
public static
array
|
#
createRule( callable|integer $mRule )
Based on the first parameter which is a rule/callback (int/callable) the
method createHRCRule or createCustomRule is called. Check those methods for more
information on which parameters to pass.
Based on the first parameter which is a rule/callback (int/callable) the
method createHRCRule or createCustomRule is called. Check those methods for more
information on which parameters to pass.
Parameters
- $mRule
callable|integer $mRule
Returns
array created rule
|
public static
array
|
#
createCustomRule( callable $cRule, array $aArgs = array(), integer $iArgIndex = null, string $sCompareOperator = "==", mixed $mCompareValeu = true )
Parameters
- $cRule
callable $cRule
- $aArgs
array $aArgs
- $iArgIndex
integer $iArgIndex optional
- $sCompareOperator
string $sCompareOperator
- $mCompareValeu
mixed $mCompareValeu
Returns
array
|
public static
array|null
|
#
createHRCRule( integer $iRule, mixed $arg1 = null, mixed $arg2 = null, mixed $arg3 = null )
Creates a rule based on the arguments. Mostly uses the function filter_var.
Using this method it is easier to pass arguments than it would be in
createCustomRule using "filter_var" as callable. Mostly, all the arguments,
except the first one, are optional
Creates a rule based on the arguments. Mostly uses the function filter_var.
Using this method it is easier to pass arguments than it would be in
createCustomRule using "filter_var" as callable. Mostly, all the arguments,
except the first one, are optional
<pre>
->createHRCRule(HRC::BOOL, array|int $flag)
->createHRCRule(HRC::INT, int $iMin=null, int $iMax=null, array|int $flag)
->createHRCRule(HRC::FLOAT, string $sDecimal=null, array|int $flag)
->createHRCRule(HRC::IP, array|int $flag)
->createHRCRule(HRC::URL, array|int $flag)
->createHRCRule(HRC::EMAIL)
->createHRCRule(HRC::REGEXP, $sRegExp)
</pre>
Parameters
- $iRule
integer $iRule class constant indicating which rule to use
- $arg1
mixed $arg1
- $arg2
mixed $arg2
- $arg3
mixed $arg3
Returns
array|null
|
public
HRC
|
#
setRequestMethod( string $sType = "REQUEST" )
Parameters
- $sType
string $sType of request, e.g. REQUEST, POST, GET
Returns
HRC
the object instance to support chanability
|
public
HRC
|
#
check( string|array $key, string $sDesiredName = null )
Stores the information about a desired value in superglobals to check
Stores the information about a desired value in superglobals to check
Parameters
- $key
string|array $key key of value we want to check. When array is e.g. array("cat","col") it
would check for instance $_POST["cat"]["col"]
- $sDesiredName
string $desiredName name you want to use within HRC. It is mandatory when $key is an
array
Returns
|
public
|
|
protected
mixed
|
#
_callFn( callable $callable, type $value, array $aArgs = array(), integer $iValIndex = null )
Parameters
- $callable
callable $callable callback to execute
- $value
type $value value we want to pass to the callback. Thi value is usually the one from
superglobals
- $aArgs
array $aArgs list of additional arguments passed to the callback. If $aArgs is not an
array, it is automatically wrapped into one.
- $iValIndex
integer $iValIndex zero-based position index of $value in the $aArgs. If null, $value is
appended to $aArgs
Returns
mixed callback return value
Throws
Exception
in case an exception from callback is thrown, it is re-thrown
|
protected
string|array
&
|
#
_getFromGlobal( string|array $key, string|array $default = null )
Gets a value from a superglobal
Gets a value from a superglobal
Parameters
- $key
string|array $key key of variable|array of keys for e.g. $_POST['category']['name']
- $default
string|array $default value to return if the searched var is not found
Returns
string|array retrieved varible; by reference
Throws
HRCException
if the var doesn't exist, and no default value is set
|
protected
array
&
|
#
_get( string $sName = null )
Gets the parameter setting
Gets the parameter setting
Parameters
- $sName
string $sName name of the parameter
Returns
array setting for a parameter. The current parameter is returned if no parameter
spiceifed. NULL if not found.
|
public
|
|
public
|
|
public
|
#
getAll( mixed $returnArrayObject = false )
|
public
HRC
|
#
setDefault( string|array $value, string $sName = null )
In case a variable is not set (!isset()) but we don't want any error to
occur. We can set a default value which is used in case the desired parameter is
not set.
In case a variable is not set (!isset()) but we don't want any error to
occur. We can set a default value which is used in case the desired parameter is
not set.
Parameters
- $value
string|array $value the default value for a parameter if it is not set. Note that it has to
be a string or possibly an array. More specifically, the value NULL will not
work.
- $sName
string $sName name of the parameter in \HRC. If it is not set, the last one/current one
is used
Returns
Throws
|
public
HRC
|
#
addRule( mixed $mRule, type $aArgs = array(), type $iArgIndex = null, type $sCompareOperator = "==", type $mCompareValue = true )
The method adds a new rule to used to validate input parameter. Based on the
arguments, to create a new rule, a static method "createCustomRule" or
"createHRCRule" is used to generate the actual rule. Then, it is saved inside
our object. For more information see those methods
The method adds a new rule to used to validate input parameter. Based on the
arguments, to create a new rule, a static method "createCustomRule" or
"createHRCRule" is used to generate the actual rule. Then, it is saved inside
our object. For more information see those methods
Parameters
- $mRule
mixed $mRule
- $aArgs
type $aArgs
- $iArgIndex
type $iArgIndex
- $sCompareOperator
type $sCompareOperator
- $mCompareValue
type $mCompareValue
Returns
See
TODO
comment HRC::createCustomRule
|
public
|
#
addArrayItemRule( mixed $cRule, mixed $aArgs = array(), mixed $iArgIndex = null, mixed $sCompareOperator = "==", mixed $mCompareValue = true )
|
public
|
#
addMultiRule( array $aRule1, mixed $aRuleN = null, mixed $bCheckArrayItems = false )
|
protected
|
|
protected
|
|
protected
|
|