Code Duplication    Length = 9-10 lines in 2 locations

src/Serializer/JsonApiSerializer.php 2 locations

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