mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Visual Console Refactor: add a new util function
Former-commit-id: 8b6266651ac81fcdd18a12b71f3f316eb246277a
This commit is contained in:
parent
f0c9957838
commit
ead487b24b
@ -182,6 +182,21 @@ abstract class Model
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a valid float or a default value from a unknown value.
|
||||
*
|
||||
* @param mixed $val Input value.
|
||||
* @param mixed $def Default value.
|
||||
*
|
||||
* @return mixed A valid float extracted from the input or the
|
||||
* default value.
|
||||
*/
|
||||
protected static function parseFloatOr($val, $def)
|
||||
{
|
||||
return (is_numeric($val) === true) ? (float) $val : $def;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a value from a dictionary from a possible pool of keys.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user