Code Duplication    Length = 9-10 lines in 2 locations

src/Serializer/JsonApiSerializer.php 2 locations

@@ 176-184 (lines=9) @@
173
174
                $includeObjects = $this->createIncludeObjects($includeObject);
175
176
                foreach ($includeObjects as $object) {
177
                    $includeType = $object['type'];
178
                    $includeId = $object['id'];
179
                    $cacheKey = "$includeType:$includeId";
180
                    if (!array_key_exists($cacheKey, $linkedIds)) {
181
                        $serializedData[] = $object;
182
                        $linkedIds[$cacheKey] = $object;
183
                    }
184
                }
185
            }
186
        }
187
@@ 385-394 (lines=10) @@
382
        foreach ($data as $value) {
383
            foreach ($value as $includeObject) {
384
                if (isset($includeObject['included'])) {
385
                    foreach ($includeObject['included'] as $object) {
386
                        $includeType = $object['type'];
387
                        $includeId = $object['id'];
388
                        $cacheKey = "$includeType:$includeId";
389
390
                        if (!array_key_exists($cacheKey, $linkedIds)) {
391
                            $includedData[] = $object;
392
                            $linkedIds[$cacheKey] = $object;
393
                        }
394
                    }
395
                }
396
            }
397
        }