💡 Add phpdoc for N°1835 new Sanitize param

This commit is contained in:
Pierre Goiffon
2019-03-21 12:01:27 +01:00
parent ed95f4e05f
commit 4918b9c83a

View File

@@ -274,6 +274,17 @@ class utils
return $retValue; return $retValue;
} }
/**
* @param string|string[] $value
* @param string $sSanitizationFilter one of : integer, class, string, context_param, parameter, field_name,
* transaction_id, parameter, raw_data
*
* @return string|string[]|bool boolean for :
* * the 'class' filter (true if valid, false otherwise)
* * if the filter fails (@see \filter_var())
*
* @since 2.5.2 2.6.0 new 'transaction_id' filter
*/
protected static function Sanitize_Internal($value, $sSanitizationFilter) protected static function Sanitize_Internal($value, $sSanitizationFilter)
{ {
switch ($sSanitizationFilter) switch ($sSanitizationFilter)
@@ -329,11 +340,13 @@ class utils
break; break;
case 'field_name': case 'field_name':
$retValue = filter_var($value, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/^[A-Za-z0-9_]+(->[A-Za-z0-9_]+)*$/'))); // att_code or att_code->name or AttCode->Name or AttCode->Key2->Name $retValue = filter_var($value, FILTER_VALIDATE_REGEXP,
array("options" => array("regexp" => '/^[A-Za-z0-9_]+(->[A-Za-z0-9_]+)*$/'))); // att_code or att_code->name or AttCode->Name or AttCode->Key2->Name
break; break;
case 'context_param': case 'context_param':
$retValue = filter_var($value, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/^[ A-Za-z0-9_=%:+-]*$/'))); $retValue = filter_var($value, FILTER_VALIDATE_REGEXP,
array("options" => array("regexp" => '/^[ A-Za-z0-9_=%:+-]*$/')));
break; break;
} }
@@ -345,6 +358,7 @@ class utils
$retValue = $value; $retValue = $value;
// Do nothing // Do nothing
} }
return $retValue; return $retValue;
} }