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
@@ 394-403 (lines=10) @@
391
        foreach ($data as $value) {
392
            foreach ($value as $includeObject) {
393
                if (isset($includeObject['included'])) {
394
                    foreach ($includeObject['included'] as $object) {
395
                        $includeType = $object['type'];
396
                        $includeId = $object['id'];
397
                        $cacheKey = "$includeType:$includeId";
398
399
                        if (!array_key_exists($cacheKey, $linkedIds)) {
400
                            $includedData[] = $object;
401
                            $linkedIds[$cacheKey] = $object;
402
                        }
403
                    }
404
                }
405
            }
406
        }