class ClassConstantAccessor
Hierarchy
- class \OpenTelemetry\SDK\Common\Util\ClassConstantAccessor
Expanded class hierarchy of ClassConstantAccessor
1 file declares its use of ClassConstantAccessor
- Configuration.php in vendor/
open-telemetry/ sdk/ Common/ Configuration/ Configuration.php
File
-
vendor/
open-telemetry/ sdk/ Common/ Util/ ClassConstantAccessor.php, line 9
Namespace
OpenTelemetry\SDK\Common\UtilView source
class ClassConstantAccessor {
public static function requireValue(string $className, string $constantName) {
$constant = self::getFullName($className, $constantName);
if (!defined($constant)) {
throw new LogicException(sprintf('The class "%s" does not have a constant "%s"', $className, $constantName));
}
return constant($constant);
}
public static function getValue(string $className, string $constantName) {
$constant = self::getFullName($className, $constantName);
return defined($constant) ? constant($constant) : null;
}
private static function getFullName(string $className, string $constantName) : string {
return $className . '::' . $constantName;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ClassConstantAccessor::getFullName | private static | function | |
ClassConstantAccessor::getValue | public static | function | |
ClassConstantAccessor::requireValue | public static | function |