| Conditions | 6 |
| Paths | 6 |
| Total Lines | 28 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 7.3329 |
| Changes | 0 | ||
| 1 | <?php |
||
| 75 | 1 | public static function getCacheKey($value): string |
|
| 76 | { |
||
| 77 | 1 | static $preventGarbageCollectorFromDestroyingObject = []; |
|
| 78 | |||
| 79 | 1 | if (is_object($value)) { |
|
| 80 | 1 | $preventGarbageCollectorFromDestroyingObject[] = $value; |
|
| 81 | |||
| 82 | 1 | return spl_object_hash($value); |
|
| 83 | } |
||
| 84 | |||
| 85 | 1 | if (is_array($value)) { |
|
| 86 | 1 | $key = '[ARRAY|'; |
|
| 87 | 1 | foreach ($value as $i => $modelInCollection) { |
|
| 88 | 1 | $key .= $i . '>' . self::getCacheKey($modelInCollection) . ':'; |
|
| 89 | } |
||
| 90 | |||
| 91 | 1 | return $key . ']'; |
|
| 92 | } |
||
| 93 | |||
| 94 | if (is_bool($value)) { |
||
| 95 | return '[BOOL|' . $value . ']'; |
||
| 96 | } |
||
| 97 | |||
| 98 | if ($value === null) { |
||
| 99 | return '[NULL]'; |
||
| 100 | } |
||
| 101 | |||
| 102 | return (string) $value; |
||
| 103 | } |
||
| 105 |