We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 6 |
Paths | 5 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
19 | 43 | public static function valueFromObjectOrArray($objectOrArray, $fieldName) |
|
20 | { |
||
21 | 43 | $value = null; |
|
22 | 43 | if (\is_array($objectOrArray) && isset($objectOrArray[$fieldName])) { |
|
23 | 36 | $value = $objectOrArray[$fieldName]; |
|
24 | 21 | } elseif (\is_object($objectOrArray)) { |
|
25 | 19 | if (null !== $getter = self::guessObjectMethod($objectOrArray, $fieldName, 'get')) { |
|
26 | 17 | $value = $objectOrArray->$getter(); |
|
27 | 2 | } elseif (isset($objectOrArray->$fieldName)) { |
|
28 | 1 | $value = $objectOrArray->$fieldName; |
|
29 | } |
||
30 | } |
||
31 | |||
32 | 43 | return $value; |
|
33 | } |
||
44 |