Code Duplication    Length = 13-16 lines in 2 locations

src/Query/LaravelReadQuery.php 2 locations

@@ 289-304 (lines=16) @@
286
     *
287
     * @return object|null The related resource if found else null
288
     */
289
    public function getRelatedResourceReference(
290
        ResourceSet $sourceResourceSet,
291
        $sourceEntityInstance,
292
        ResourceSet $targetResourceSet,
293
        ResourceProperty $targetProperty
294
    ) {
295
        if (!($sourceEntityInstance instanceof Model)) {
296
            throw new InvalidArgumentException('Source entity must be an Eloquent model.');
297
        }
298
        $this->checkSourceInstance($sourceEntityInstance);
299
300
        $this->checkAuth($sourceEntityInstance);
301
302
        $propertyName = $targetProperty->getName();
303
        return $sourceEntityInstance->$propertyName;
304
    }
305
306
    /**
307
     * Gets a related entity instance from an entity set identified by a key
@@ 318-330 (lines=13) @@
315
     *
316
     * @return object|null Returns entity instance if found else null
317
     */
318
    public function getResourceFromRelatedResourceSet(
319
        ResourceSet $sourceResourceSet,
320
        $sourceEntityInstance,
321
        ResourceSet $targetResourceSet,
322
        ResourceProperty $targetProperty,
323
        KeyDescriptor $keyDescriptor
324
    ) {
325
        if (!($sourceEntityInstance instanceof Model)) {
326
            throw new InvalidArgumentException('Source entity must be an Eloquent model.');
327
        }
328
        $propertyName = $targetProperty->getName();
329
        return $this->getResource(null, $keyDescriptor, [], $sourceEntityInstance->$propertyName);
330
    }
331
332
333
    /**