Code Duplication    Length = 9-10 lines in 2 locations

src/Serializer/JsonApiSerializer.php 2 locations

@@ 174-182 (lines=9) @@
171
                    $includeObjects = [$includeObject['data']];
172
                }
173
174
                foreach ($includeObjects as $object) {
175
                    $includeType = $object['type'];
176
                    $includeId = $object['id'];
177
                    $cacheKey = "$includeType:$includeId";
178
                    if (!array_key_exists($cacheKey, $linkedIds)) {
179
                        $serializedData[] = $object;
180
                        $linkedIds[$cacheKey] = $object;
181
                    }
182
                }
183
            }
184
        }
185
@@ 441-450 (lines=10) @@
438
        foreach ($data as $value) {
439
            foreach ($value as $includeObject) {
440
                if (isset($includeObject['included'])) {
441
                    foreach ($includeObject['included'] as $object) {
442
                        $includeType = $object['type'];
443
                        $includeId = $object['id'];
444
                        $cacheKey = "$includeType:$includeId";
445
446
                        if (!array_key_exists($cacheKey, $linkedIds)) {
447
                            $includedData[] = $object;
448
                            $linkedIds[$cacheKey] = $object;
449
                        }
450
                    }
451
                }
452
            }
453
        }