1
0
Fork 0

Remove x() function

This commit is contained in:
Hypolite Petovan 2018-11-30 09:07:02 -05:00
parent 458981f75c
commit 065509cc9a

View file

@ -338,42 +338,6 @@ function get_app()
return BaseObject::getApp(); return BaseObject::getApp();
} }
/**
* @brief Multi-purpose function to check variable state.
*
* Usage: x($var) or x($array, 'key')
*
* returns false if variable/key is not set
* if variable is set, returns 1 if has 'non-zero' value, otherwise returns 0.
* e.g. x('') or x(0) returns 0;
*
* @deprecated since version 2018.12
* @param string|array $s variable to check
* @param string $k key inside the array to check
*
* @return bool|int
*/
function x($s, $k = null)
{
if ($k != null) {
if ((is_array($s)) && (array_key_exists($k, $s))) {
if ($s[$k]) {
return (int) 1;
}
return (int) 0;
}
return false;
} else {
if (isset($s)) {
if ($s) {
return (int) 1;
}
return (int) 0;
}
return false;
}
}
/** /**
* Return the provided variable value if it exists and is truthy or the provided * Return the provided variable value if it exists and is truthy or the provided
* default value instead. * default value instead.