| Conditions | 5 |
| Paths | 6 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | 5 | protected function hydrateUserWithAttributesMap( |
|
| 25 | UserInterface $user, |
||
| 26 | array $ldapUserAttributes, |
||
| 27 | array $attributeMap |
||
| 28 | ) { |
||
| 29 | 5 | foreach ($attributeMap as $attr) { |
|
| 30 | 5 | if (!array_key_exists($attr['ldap_attr'], $ldapUserAttributes)) { |
|
| 31 | 5 | continue; |
|
| 32 | } |
||
| 33 | |||
| 34 | 4 | $ldapValue = $ldapUserAttributes[$attr['ldap_attr']]; |
|
| 35 | |||
| 36 | 4 | if (array_key_exists('count', $ldapValue)) { |
|
| 37 | 2 | unset($ldapValue['count']); |
|
| 38 | 2 | } |
|
| 39 | |||
| 40 | 4 | if (1 === count($ldapValue)) { |
|
| 41 | 2 | $value = array_shift($ldapValue); |
|
| 42 | 2 | } else { |
|
| 43 | 2 | $value = $ldapValue; |
|
| 44 | } |
||
| 45 | |||
| 46 | 4 | call_user_func([$user, $attr['user_method']], $value); |
|
| 47 | 5 | } |
|
| 50 |