|  | @@ 325-340 (lines=16) @@ | 
                                                            
                                    | 322 |  |      * | 
                                                            
                                    | 323 |  |      * @return object|null The related resource if found else null | 
                                                            
                                    | 324 |  |      */ | 
                                                            
                                    | 325 |  |     public function getRelatedResourceReference( | 
                                                            
                                    | 326 |  |         ResourceSet $sourceResourceSet, | 
                                                            
                                    | 327 |  |         $sourceEntityInstance, | 
                                                            
                                    | 328 |  |         ResourceSet $targetResourceSet, | 
                                                            
                                    | 329 |  |         ResourceProperty $targetProperty | 
                                                            
                                    | 330 |  |     ) { | 
                                                            
                                    | 331 |  |         if (!($sourceEntityInstance instanceof Model)) { | 
                                                            
                                    | 332 |  |             throw new InvalidArgumentException('Source entity must be an Eloquent model.'); | 
                                                            
                                    | 333 |  |         } | 
                                                            
                                    | 334 |  |         $this->checkSourceInstance($sourceEntityInstance); | 
                                                            
                                    | 335 |  |  | 
                                                            
                                    | 336 |  |         $this->checkAuth($sourceEntityInstance); | 
                                                            
                                    | 337 |  |  | 
                                                            
                                    | 338 |  |         $propertyName = $targetProperty->getName(); | 
                                                            
                                    | 339 |  |         return $sourceEntityInstance->$propertyName; | 
                                                            
                                    | 340 |  |     } | 
                                                            
                                    | 341 |  |  | 
                                                            
                                    | 342 |  |     /** | 
                                                            
                                    | 343 |  |      * Gets a related entity instance from an entity set identified by a key | 
                                                                                
                                |  | @@ 354-366 (lines=13) @@ | 
                                                            
                                    | 351 |  |      * | 
                                                            
                                    | 352 |  |      * @return object|null Returns entity instance if found else null | 
                                                            
                                    | 353 |  |      */ | 
                                                            
                                    | 354 |  |     public function getResourceFromRelatedResourceSet( | 
                                                            
                                    | 355 |  |         ResourceSet $sourceResourceSet, | 
                                                            
                                    | 356 |  |         $sourceEntityInstance, | 
                                                            
                                    | 357 |  |         ResourceSet $targetResourceSet, | 
                                                            
                                    | 358 |  |         ResourceProperty $targetProperty, | 
                                                            
                                    | 359 |  |         KeyDescriptor $keyDescriptor | 
                                                            
                                    | 360 |  |     ) { | 
                                                            
                                    | 361 |  |         if (!($sourceEntityInstance instanceof Model)) { | 
                                                            
                                    | 362 |  |             throw new InvalidArgumentException('Source entity must be an Eloquent model.'); | 
                                                            
                                    | 363 |  |         } | 
                                                            
                                    | 364 |  |         $propertyName = $targetProperty->getName(); | 
                                                            
                                    | 365 |  |         return $this->getResource(null, $keyDescriptor, [], $sourceEntityInstance->$propertyName); | 
                                                            
                                    | 366 |  |     } | 
                                                            
                                    | 367 |  |  | 
                                                            
                                    | 368 |  |  | 
                                                            
                                    | 369 |  |     /** |