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

Breadcrumb

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

function PsrUtils::encoder

1 call to PsrUtils::encoder()
PsrUtils::encode in vendor/open-telemetry/sdk/Common/Export/Http/PsrUtils.php

File

vendor/open-telemetry/sdk/Common/Export/Http/PsrUtils.php, line 130

Class

PsrUtils
@internal

Namespace

OpenTelemetry\SDK\Common\Export\Http

Code

private static function encoder(string $encoding) : ?callable {
    static $encoders;
    
    /** @noinspection SpellCheckingInspection */
    $encoders ??= array_map(fn(callable $callable): callable => self::throwOnErrorOrFalse($callable), array_filter([
        TransportFactoryInterface::COMPRESSION_GZIP => 'gzencode',
        TransportFactoryInterface::COMPRESSION_DEFLATE => 'gzcompress',
        TransportFactoryInterface::COMPRESSION_BROTLI => 'brotli_compress',
    ], 'function_exists'));
    return $encoders[$encoding] ?? null;
}

API Navigation

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