| 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 | 15 | public static function fixScalarId($id, ApiMetadata $metadata) |
|
| 18 | { |
||
| 19 | 15 | if (is_array($id)) { |
|
| 20 | 6 | return $id; |
|
| 21 | } |
||
| 22 | |||
| 23 | 14 | $id = (array)$id; |
|
| 24 | |||
| 25 | 14 | $identifiers = $metadata->getIdentifierFieldNames(); |
|
| 26 | 14 | if (count($id) !== count($identifiers)) { |
|
| 27 | throw MappingException::invalidIdentifierStructure(); |
||
| 28 | } |
||
| 29 | |||
| 30 | 14 | return array_combine($identifiers, (array)$id); |
|
| 31 | } |
||
| 32 | } |
||
| 33 |