class Configuration
Same name in this branch
- 11.1.x vendor/phpunit/phpunit/src/TextUI/Configuration/Xml/Configuration.php \PHPUnit\TextUI\XmlConfiguration\Configuration
- 11.1.x vendor/phpunit/phpunit/src/TextUI/Configuration/Cli/Configuration.php \PHPUnit\TextUI\CliArguments\Configuration
- 11.1.x vendor/phpunit/phpunit/src/TextUI/Configuration/Configuration.php \PHPUnit\TextUI\Configuration\Configuration
Configuration can come from one or more of the following sources (from highest to lowest priority):
- values defined in php.ini
- environment variable ($_SERVER)
- configuration file (todo)
Hierarchy
- class \OpenTelemetry\SDK\Common\Configuration\Configuration uses \OpenTelemetry\API\Behavior\LogsMessagesTrait
Expanded class hierarchy of Configuration
21 files declare their use of Configuration
- AutoRootSpan.php in vendor/
open-telemetry/ sdk/ Trace/ AutoRootSpan.php - CompositeResolver.php in vendor/
open-telemetry/ sdk/ Common/ Configuration/ Resolver/ CompositeResolver.php - Environment.php in vendor/
open-telemetry/ sdk/ Resource/ Detectors/ Environment.php - EnvironmentResolver.php in vendor/
open-telemetry/ sdk/ Common/ Configuration/ Resolver/ EnvironmentResolver.php - ExporterFactory.php in vendor/
open-telemetry/ sdk/ Trace/ ExporterFactory.php
159 string references to 'Configuration'
- action_settings.yml in core/
modules/ system/ migrations/ action_settings.yml - core/modules/system/migrations/action_settings.yml
- Application::writeRuntimeInformation in vendor/
phpunit/ phpunit/ src/ TextUI/ Application.php - block_content_body_field.yml in core/
modules/ block_content/ migrations/ block_content_body_field.yml - core/modules/block_content/migrations/block_content_body_field.yml
- block_content_entity_display.yml in core/
modules/ block_content/ migrations/ block_content_entity_display.yml - core/modules/block_content/migrations/block_content_entity_display.yml
- block_content_entity_form_display.yml in core/
modules/ block_content/ migrations/ block_content_entity_form_display.yml - core/modules/block_content/migrations/block_content_entity_form_display.yml
File
-
vendor/
open-telemetry/ sdk/ Common/ Configuration/ Configuration.php, line 23
Namespace
OpenTelemetry\SDK\Common\ConfigurationView source
class Configuration {
use LogsMessagesTrait;
public static function has(string $name) : bool {
return CompositeResolver::instance()->hasVariable($name);
}
public static function getInt(string $key, ?int $default = null) : int {
return (int) self::validateVariableValue(CompositeResolver::instance()->resolve(self::validateVariableType($key, VariableTypes::INTEGER), $default), FILTER_VALIDATE_INT);
}
public static function getString(string $key, ?string $default = null) : string {
return (string) self::validateVariableValue(CompositeResolver::instance()->resolve(self::validateVariableType($key, VariableTypes::STRING), $default));
}
public static function getBoolean(string $key, ?bool $default = null) : bool {
$resolved = self::validateVariableValue(CompositeResolver::instance()->resolve(self::validateVariableType($key, VariableTypes::BOOL), null === $default ? $default : ($default ? 'true' : 'false')));
try {
return BooleanParser::parse($resolved);
} catch (InvalidArgumentException) {
self::logWarning(sprintf('Invalid boolean value "%s" interpreted as "false" for %s', $resolved, $key));
return false;
}
}
public static function getMixed(string $key, $default = null) {
return self::validateVariableValue(CompositeResolver::instance()->resolve($key, $default));
}
public static function getMap(string $key, ?array $default = null) : array {
return MapParser::parse(CompositeResolver::instance()->resolve(self::validateVariableType($key, VariableTypes::MAP), $default));
}
public static function getList(string $key, ?array $default = null) : array {
return ListParser::parse(CompositeResolver::instance()->resolve(self::validateVariableType($key, VariableTypes::LIST), $default));
}
public static function getEnum(string $key, ?string $default = null) : string {
return (string) self::validateVariableValue(CompositeResolver::instance()->resolve(self::validateVariableType($key, VariableTypes::ENUM), $default));
}
public static function getFloat(string $key, ?float $default = null) : float {
return (double) self::validateVariableValue(CompositeResolver::instance()->resolve(self::validateVariableType($key, VariableTypes::FLOAT), $default), FILTER_VALIDATE_FLOAT);
}
public static function getRatio(string $key, ?float $default = null) : float {
return RatioParser::parse(self::validateVariableValue(CompositeResolver::instance()->resolve(self::validateVariableType($key, VariableTypes::RATIO), $default)));
}
public static function getKnownValues(string $variableName) : ?array {
return ClassConstantAccessor::getValue(KnownValues::class, $variableName);
}
public static function getDefault(string $variableName) {
return ClassConstantAccessor::getValue(Defaults::class, $variableName);
}
public static function getType(string $variableName) : ?string {
return ClassConstantAccessor::getValue(ValueTypes::class, $variableName);
}
public static function isEmpty($value) : bool {
// don't use 'empty()', since '0' is not considered to be empty
return $value === null || $value === '';
}
private static function validateVariableType(string $variableName, string $type) : string {
$variableType = self::getType($variableName);
if ($variableType !== null && $variableType !== $type && $variableType !== VariableTypes::MIXED) {
throw new UnexpectedValueException(sprintf('Variable "%s" is not supposed to be of type "%s" but type "%s"', $variableName, $type, $variableType));
}
return $variableName;
}
private static function validateVariableValue($value, ?int $filterType = null) {
if ($filterType !== null && filter_var($value, $filterType) === false) {
throw new UnexpectedValueException(sprintf('Value has invalid type "%s"', gettype($value)));
}
if ($value === null || $value === '') {
throw new UnexpectedValueException('Variable must not be null or empty');
}
return $value;
}
}