Code Duplication    Length = 9-10 lines in 2 locations

src/Serializer/JsonApiSerializer.php 2 locations

@@ 181-189 (lines=9) @@
178
179
                $includeObjects = $this->createIncludeObjects($includeObject);
180
181
                foreach ($includeObjects as $object) {
182
                    $includeType = $object['type'];
183
                    $includeId = $object['id'];
184
                    $cacheKey = "$includeType:$includeId";
185
                    if (!array_key_exists($cacheKey, $linkedIds)) {
186
                        $serializedData[] = $object;
187
                        $linkedIds[$cacheKey] = $object;
188
                    }
189
                }
190
            }
191
        }
192
@@ 390-399 (lines=10) @@
387
        foreach ($data as $value) {
388
            foreach ($value as $includeObject) {
389
                if (isset($includeObject['included'])) {
390
                    foreach ($includeObject['included'] as $object) {
391
                        $includeType = $object['type'];
392
                        $includeId = $object['id'];
393
                        $cacheKey = "$includeType:$includeId";
394
395
                        if (!array_key_exists($cacheKey, $linkedIds)) {
396
                            $includedData[] = $object;
397
                            $linkedIds[$cacheKey] = $object;
398
                        }
399
                    }
400
                }
401
            }
402
        }