| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 2 | public function getRecordIdentifier(DataBagInterface $dataBag): array |
|
| 28 | { |
||
| 29 | 2 | $ids = []; |
|
| 30 | 2 | foreach ($this->fields as $key => $value) { |
|
| 31 | 2 | if ($value === null) { |
|
| 32 | 2 | if (!isset($dataBag[$key])) { |
|
| 33 | 1 | throw new InvalidConfigException( |
|
| 34 | 1 | sprintf('Identifier field %s is missing in the bag: %s.', $key, json_encode($dataBag)) |
|
| 35 | ); |
||
| 36 | } |
||
| 37 | 1 | $ids[$key] = $dataBag[$key]; |
|
| 38 | } else { |
||
| 39 | 1 | $ids[$key] = $value; |
|
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | 1 | return $ids; |
|
| 44 | } |
||
| 45 | } |
||
| 46 |