function GPBUtil::checkFloat
3 calls to GPBUtil::checkFloat()
- FloatValue::setValue in vendor/
google/ protobuf/ src/ Google/ Protobuf/ FloatValue.php - The float value.
- MapField::offsetSet in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ MapField.php - Assign the element at the given key.
- RepeatedField::offsetSet in vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ RepeatedField.php - Assign the element at the given index.
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ GPBUtil.php, line 146
Class
Namespace
Google\Protobuf\InternalCode
public static function checkFloat(&$var) {
if (is_float($var) || is_numeric($var)) {
$var = unpack("f", pack("f", $var))[1];
}
else {
throw new \Exception("Expect float.");
}
}