class BooleanParser
Hierarchy
- class \OpenTelemetry\SDK\Common\Configuration\Parser\BooleanParser
Expanded class hierarchy of BooleanParser
1 file declares its use of BooleanParser
- Configuration.php in vendor/
open-telemetry/ sdk/ Common/ Configuration/ Configuration.php
File
-
vendor/
open-telemetry/ sdk/ Common/ Configuration/ Parser/ BooleanParser.php, line 9
Namespace
OpenTelemetry\SDK\Common\Configuration\ParserView source
class BooleanParser {
private const TRUE_VALUE = 'true';
private const FALSE_VALUE = 'false';
/**
* @param string|bool $value
*/
public static function parse($value) : bool {
if (is_bool($value)) {
return $value;
}
if (strtolower($value) === self::TRUE_VALUE) {
return true;
}
if (strtolower($value) === self::FALSE_VALUE) {
return false;
}
throw new InvalidArgumentException(sprintf('Value "%s" is a non-boolean value', $value));
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
BooleanParser::FALSE_VALUE | private | constant | |
BooleanParser::parse | public static | function | |
BooleanParser::TRUE_VALUE | private | constant |