Code Duplication    Length = 14-14 lines in 2 locations

src/Serializers/ModelSerializer.php 2 locations

@@ 201-214 (lines=14) @@
198
     *
199
     * @return \Illuminate\Support\Collection
200
     */
201
    protected function transformRecordRelations()
202
    {
203
        $relationships = collect([]);
204
205
        foreach ($this->relationships as $relation) {
206
            $data = $this->mapRelation($relation, function ($record) {
207
                return (new static($record))->toResourceIdentifier();
208
            });
209
210
            $relationships = $relationships->merge([$relation => compact('data')]);
211
        }
212
213
        return $relationships;
214
    }
215
216
    /**
217
     * Return a collection of JSON API resource objects for each included
@@ 222-235 (lines=14) @@
219
     *
220
     * @return \Illuminate\Support\Collection
221
     */
222
    protected function transformIncludedRelations()
223
    {
224
        $included = collect([]);
225
226
        foreach ($this->include as $relation) {
227
            $records = $this->mapRelation($relation, function ($record) {
228
                return (new static($record))->toBaseResourceObject();
229
            });
230
231
            $included = $included->merge(collect($records));
232
        }
233
234
        return $included;
235
    }
236
237
    /**
238
     * Run a map over each item in a loaded relation on the primary record.