OperandsCache::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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