Skip to content

Commit

Permalink
preserve arrays without @id (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
seth-shaw-unlv authored Jun 24, 2022
1 parent 630e109 commit 3686e94
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Normalizer/NormalizerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,8 @@ protected static function deduplicateTypesAndReferences(array $array): array {
*/
private static function deduplicateArrayOfIds(array $array): array {
$temp_array = [];
if (!isset($array[0]['@id'])) {
// No @id key, so just return the original array.
return $array;
}
foreach ($array as $val) {
if (array_search($val['@id'], array_column($temp_array, '@id')) === FALSE) {
if (!array_key_exists('@id', $val) || array_search($val['@id'], array_column($temp_array, '@id')) === FALSE) {
$temp_array[] = $val;
}
}
Expand Down

0 comments on commit 3686e94

Please sign in to comment.