function RatioParser::parse
1 call to RatioParser::parse()
- Configuration::getRatio in vendor/
open-telemetry/ sdk/ Common/ Configuration/ Configuration.php
File
-
vendor/
open-telemetry/ sdk/ Common/ Configuration/ Parser/ RatioParser.php, line 15
Class
Namespace
OpenTelemetry\SDK\Common\Configuration\ParserCode
public static function parse($value) : float {
if (filter_var($value, FILTER_VALIDATE_FLOAT) === false) {
throw new InvalidArgumentException(sprintf('Value "%s" contains non-numeric value', $value));
}
$result = (double) $value;
if ($result > self::MAX_VALUE || $result < self::MIN_VALUE) {
throw new RangeException(sprintf('Value must not be lower than %s or higher than %s. Given: %s', self::MIN_VALUE, self::MAX_VALUE, $value));
}
return $result;
}