| Conditions | 4 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function createValue($fieldValueArray, array $context = array()) |
||
| 24 | { |
||
| 25 | 1 | if (array_key_exists('destinationContentIds', $fieldValueArray)) { |
|
| 26 | 1 | // fromHash format |
|
| 27 | 1 | $ids = $fieldValueArray['destinationContentIds']; |
|
| 28 | 1 | } elseif (is_array($fieldValueArray)) { |
|
| 29 | 1 | // simplified format |
|
| 30 | $ids = $fieldValueArray; |
||
| 31 | 1 | } else { |
|
| 32 | $ids = array(); |
||
| 33 | } |
||
| 34 | |||
| 35 | foreach ($ids as $key => $id) { |
||
| 36 | // 1. resolve relations |
||
| 37 | $ids[$key] = $this->referenceResolver->resolveReference($id); |
||
| 38 | // 2. resolve remote ids |
||
| 39 | $ids[$key] = $this->contentMatcher->matchOneByKey($ids[$key])->id; |
||
| 40 | } |
||
| 41 | |||
| 42 | return new Value($ids); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |