Code Duplication    Length = 9-10 lines in 2 locations

src/Serializer/JsonApiSerializer.php 2 locations

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