Skip to content

Commit

Permalink
Merge pull request #88 from worksome/update_optional_normalize
Browse files Browse the repository at this point in the history
refactor: update optional normalization of item
  • Loading branch information
owenvoke authored Dec 11, 2023
2 parents 70685b6 + 8446631 commit ae401dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Processor/EloquentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ protected function normalizeOptionalItems(array $items): array

// go through each item
foreach ($items as $key => $item) {
$itemOptionals = $items[$key]['optional'];
$itemOptionals = call_user_func_array('array_merge', $items[$key]['optional']);

// for each item we wanna add each optional key
// and also populate value if we got one
foreach ($optionalKeys as $optionalArrKey => $optionalKey) {
$value = '';

// check if we have value for this item and populate it
if (isset($itemOptionals[$optionalArrKey][$optionalKey])) {
$value = $itemOptionals[$optionalArrKey][$optionalKey];
if (isset($itemOptionals[$optionalKey])) {
$value = $itemOptionals[$optionalKey];
}

// add the optional key and it's value
Expand Down

0 comments on commit ae401dd

Please sign in to comment.