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

Breadcrumb

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

function RatioParser::parse

1 call to RatioParser::parse()
Configuration::getRatio in vendor/open-telemetry/sdk/Common/Configuration/Configuration.php

File

vendor/open-telemetry/sdk/Common/Configuration/Parser/RatioParser.php, line 15

Class

RatioParser

Namespace

OpenTelemetry\SDK\Common\Configuration\Parser

Code

public static function parse($value) : float {
    if (filter_var($value, FILTER_VALIDATE_FLOAT) === false) {
        throw new InvalidArgumentException(sprintf('Value "%s" contains non-numeric value', $value));
    }
    $result = (double) $value;
    if ($result > self::MAX_VALUE || $result < self::MIN_VALUE) {
        throw new RangeException(sprintf('Value must not be lower than %s or higher than %s. Given: %s', self::MIN_VALUE, self::MAX_VALUE, $value));
    }
    return $result;
}

API Navigation

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