RelationCache::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
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 RelationCache
9
{
10
    /**
11
     * @param callable():Relation $new
12
     */
13
    public static function get(string $relation, callable $new): Relation
14
    {
15
        static $instances;
16
17
        return $instances[$relation] ??= $new();
18
    }
19
}
20