Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 0 |
1 | <?php |
||
17 | 11 | public static function fixScalarId($id, ApiMetadata $metadata) |
|
18 | { |
||
19 | 11 | if (is_array($id)) { |
|
20 | 5 | return $id; |
|
21 | } |
||
22 | |||
23 | 10 | $id = (array)$id; |
|
24 | |||
25 | 10 | $identifiers = $metadata->getIdentifierFieldNames(); |
|
26 | 10 | if (count($id) !== count($identifiers)) { |
|
27 | throw MappingException::invalidIdentifierStructure(); |
||
28 | } |
||
29 | |||
30 | 10 | return array_combine($identifiers, (array)$id); |
|
31 | } |
||
32 | } |
||
33 |