Conditions | 4 |
Paths | 6 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
17 | 17 | public static function get($values, string $key) |
|
18 | { |
||
19 | 17 | $asObject = is_object($values); |
|
20 | 17 | $asArray = is_array($values) || $values instanceof ArrayAccess; |
|
21 | 17 | if ($asArray) { |
|
22 | 13 | return $values[$key] ?? null; |
|
23 | } |
||
24 | 5 | if ($asObject) { |
|
25 | 3 | return $values->{$key} ?? null; |
|
26 | } |
||
27 | 2 | return null; |
|
28 | } |
||
30 |