Code Duplication    Length = 9-10 lines in 2 locations

src/Serializer/JsonApiSerializer.php 2 locations

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