Conditions | 4 |
Paths | 6 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
31 | 2 | public static function DaftObjectIdValuesHash(array $id) : string |
|
32 | { |
||
33 | 2 | static $ids = []; |
|
34 | |||
35 | 2 | $className = static::class; |
|
36 | |||
37 | 2 | $objectIds = ''; |
|
38 | 2 | foreach (array_values($id) as $i => $idVal) { |
|
39 | 2 | if ($i >= 1) { |
|
40 | 1 | $objectIds .= '::'; |
|
41 | } |
||
42 | 2 | $objectIds .= (string) $idVal; |
|
43 | } |
||
44 | |||
45 | 2 | if (false === isset($ids[$className], $ids[$className][$objectIds])) { |
|
46 | 2 | $ids[$className] = $ids[$className] ?? []; |
|
47 | 2 | $ids[$className][$objectIds] = (string) count($ids[$className]); |
|
48 | } |
||
49 | |||
50 | 2 | return $ids[$className][$objectIds]; |
|
51 | } |
||
53 |