Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Environment.php

class Environment

Same name in this branch
  1. 11.1.x vendor/php-tuf/composer-stager/src/Internal/Environment/Service/Environment.php \PhpTuf\ComposerStager\Internal\Environment\Service\Environment
  2. 11.1.x vendor/twig/twig/src/Environment.php \Twig\Environment
  3. 11.1.x core/lib/Drupal/Component/Utility/Environment.php \Drupal\Component\Utility\Environment

Hierarchy

  • class \OpenTelemetry\SDK\Resource\Detectors\Environment implements \OpenTelemetry\SDK\Resource\ResourceDetectorInterface

Expanded class hierarchy of Environment

See also

https://github.com/open-telemetry/opentelemetry-specification/blob/main…

1 string reference to 'Environment'
Kernel::__sleep in vendor/symfony/http-kernel/Kernel.php

File

vendor/open-telemetry/sdk/Resource/Detectors/Environment.php, line 17

Namespace

OpenTelemetry\SDK\Resource\Detectors
View source
final class Environment implements ResourceDetectorInterface {
    public function getResource() : ResourceInfo {
        $attributes = Configuration::has(Variables::OTEL_RESOURCE_ATTRIBUTES) ? self::decode(Configuration::getMap(Variables::OTEL_RESOURCE_ATTRIBUTES, [])) : [];
        
        //@see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#general-sdk-configuration
        $serviceName = Configuration::has(Variables::OTEL_SERVICE_NAME) ? Configuration::getString(Variables::OTEL_SERVICE_NAME) : null;
        if ($serviceName) {
            $attributes[ResourceAttributes::SERVICE_NAME] = $serviceName;
        }
        return ResourceInfo::create(Attributes::create($attributes), ResourceAttributes::SCHEMA_URL);
    }
    private static function decode(array $attributes) : array {
        return array_map('urldecode', $attributes);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
Environment::decode private static function
Environment::getResource public function Overrides ResourceDetectorInterface::getResource

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal