Code Duplication    Length = 9-10 lines in 2 locations

src/Serializer/JsonApiSerializer.php 2 locations

@@ 170-178 (lines=9) @@
167
168
                $includeObjects = $this->createIncludeObjects($includeObject);
169
170
                foreach ($includeObjects as $object) {
171
                    $includeType = $object['type'];
172
                    $includeId = $object['id'];
173
                    $cacheKey = "$includeType:$includeId";
174
                    if (!array_key_exists($cacheKey, $linkedIds)) {
175
                        $serializedData[] = $object;
176
                        $linkedIds[$cacheKey] = $object;
177
                    }
178
                }
179
            }
180
        }
181
@@ 379-388 (lines=10) @@
376
        foreach ($data as $value) {
377
            foreach ($value as $includeObject) {
378
                if (isset($includeObject['included'])) {
379
                    foreach ($includeObject['included'] as $object) {
380
                        $includeType = $object['type'];
381
                        $includeId = $object['id'];
382
                        $cacheKey = "$includeType:$includeId";
383
384
                        if (!array_key_exists($cacheKey, $linkedIds)) {
385
                            $includedData[] = $object;
386
                            $linkedIds[$cacheKey] = $object;
387
                        }
388
                    }
389
                }
390
            }
391
        }