OperandsCache   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 7 1
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
The doc comment float|int|numeric-string at position 4 could not be parsed: Unknown type name 'numeric-string' at position 4 in float|int|numeric-string.
Loading history...
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