1 | <?php |
||
2 | |||
3 | namespace ICanBoogie\CLDR\Supplemental\Plurals; |
||
4 | |||
5 | /** |
||
6 | * @internal |
||
7 | */ |
||
8 | final class OperandsCache |
||
9 | { |
||
10 | /** |
||
11 | * @param float|int|numeric-string $number |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
12 | * @param callable():Operands $new |
||
13 | */ |
||
14 | public static function get(float|int|string $number, callable $new): Operands |
||
15 | { |
||
16 | static $instances; |
||
17 | |||
18 | $key = "number-$number"; |
||
19 | |||
20 | return $instances[$key] ??= $new(); |
||
21 | } |
||
22 | } |
||
23 |