Debian Codegraph @

lib/3rdParty/composer/aws/aws-sdk-php/src/Retry/V3/OptIn.php

raw symbols SCIP
1 <?php
2 namespace Aws\Retry\V3;
3
4 /**
5 * Source of truth for the AWS_NEW_RETRIES_2026 opt-in flag. The env var
6 * is read once per process and memoized so retry decisions do not pay a
7 * getenv() cost on every attempt.
8 *
9 * @internal
10 */
11 final class OptIn
12 {
13 public const ENV = 'AWS_NEW_RETRIES_2026';
14
15 private static ?bool $enabled = null;
16
17 public static function isEnabled(): bool
18 {
19 if (self::$enabled === null) {
20 $value = getenv(self::ENV);
21 if (is_string($value) && trim($value) === 'true') {
22 self::$enabled = true;
23 } else {
24 self::$enabled = false;
25 }
26 }
27
28 return self::$enabled;
29 }
30
31 /**
32 * Clears the memoized value. Test hook only.
33 *
34 * @internal
35 */
36 public static function reset(): void
37 {
38 self::$enabled = null;
39 }
40 }