Skip to content

Commit d44959d

Browse files
rafaela-mansiniRafaela Mansini
andauthored
feature/updateVmsMapping: Removing mergeArraysByKeyValue as is not used anymore (#140)
Co-authored-by: Rafaela Mansini <rafaela.mansini@smartbox.com>
1 parent ff4907d commit d44959d

1 file changed

Lines changed: 0 additions & 38 deletions

File tree

Tools/Mapper/Mapper.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -433,42 +433,4 @@ protected function shouldAcceptEmptyValues(array $context, $obj): bool
433433

434434
return false;
435435
}
436-
437-
/**
438-
* Will merge multidimensional arrays based on a matching child element value
439-
*
440-
* Mappings Accepted Values: 'coupled', 'standard'
441-
* standard: will merge any item with the elementIdentifier
442-
* coupled: will merge an item with the elementIdentifier along with the item right below it
443-
*
444-
* @param array $parentArray
445-
* @param string $elementIdentifier
446-
* @param array $mappings
447-
*
448-
* @return array
449-
*/
450-
function mergeArraysByKeyValue(array $parentArray, string $elementIdentifier, array $mappings = [])
451-
{
452-
$mergedArray = [];
453-
foreach ($parentArray as $childKey => $childArray) {
454-
foreach ($childArray as $elementKey => $element) {
455-
if (isset($mappings['coupled']) && in_array($childKey, $mappings['coupled'], true)) {
456-
if (isset($element[$elementIdentifier])) {
457-
$mergedArray[$element[$elementIdentifier]][$childKey] = [$element, $childArray[$elementKey + 1]];
458-
}
459-
continue;
460-
}
461-
462-
if (!isset($element[$elementIdentifier])) {
463-
continue;
464-
}
465-
466-
if (isset($mappings['standard']) && in_array($childKey, $mappings['standard'], true)) {
467-
$mergedArray[$element[$elementIdentifier]][$childKey][] = $element;
468-
}
469-
}
470-
}
471-
472-
return $mergedArray;
473-
}
474436
}

0 commit comments

Comments
 (0)