Code Duplication    Length = 9-10 lines in 2 locations

src/Serializer/JsonApiSerializer.php 2 locations

@@ 173-181 (lines=9) @@
170
                    $includeObjects = [$includeObject['data']];
171
                }
172
173
                foreach ($includeObjects as $object) {
174
                    $includeType = $object['type'];
175
                    $includeId = $object['id'];
176
                    $cacheKey = "$includeType:$includeId";
177
                    if (!array_key_exists($cacheKey, $linkedIds)) {
178
                        $serializedData[] = $object;
179
                        $linkedIds[$cacheKey] = $object;
180
                    }
181
                }
182
            }
183
        }
184
@@ 434-443 (lines=10) @@
431
        foreach ($data as $value) {
432
            foreach ($value as $includeObject) {
433
                if (isset($includeObject['included'])) {
434
                    foreach ($includeObject['included'] as $object) {
435
                        $includeType = $object['type'];
436
                        $includeId = $object['id'];
437
                        $cacheKey = "$includeType:$includeId";
438
439
                        if (!array_key_exists($cacheKey, $linkedIds)) {
440
                            $includedData[] = $object;
441
                            $linkedIds[$cacheKey] = $object;
442
                        }
443
                    }
444
                }
445
            }
446
        }