Skip to content

Commit

Permalink
Remove array helper intersectKeyRecursive
Browse files Browse the repository at this point in the history
  • Loading branch information
neznaika0 committed Aug 8, 2024
1 parent c8919da commit 6bc2c49
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 209 deletions.
23 changes: 0 additions & 23 deletions system/Helpers/Array/ArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,27 +315,4 @@ public static function sortValuesByNatural(array &$array, $sortByIndex = null):
return strnatcmp((string) $currentValue, (string) $nextValue);
});
}

/**
* Returns a new array from $target with the keys that are in $original
*
* @param array<string, array<string,mixed>|string|null> $target
* @param array<string, array<string,mixed>|string|null> $original
*
* @return array<string, array<string,mixed>|string|null>
*/
public static function intersectKeyRecursive(array $target, array $original): array
{
$result = [];

foreach ($target as $key => $value) {
if (is_array($value) && isset($original[$key]) && is_array($original[$key])) {
$result[$key] = self::intersectKeyRecursive($value, $original[$key]);
} elseif (array_key_exists($key, $original)) {
$result[$key] = $value;
}
}

return $result;
}
}
186 changes: 0 additions & 186 deletions tests/system/Helpers/Array/ArrayHelperIntersectKeyRecursiveTest.php

This file was deleted.

0 comments on commit 6bc2c49

Please sign in to comment.