original_string: protected function setReferenceSource()
      {
          if (null !== $this->info->reference->source) {
              return $this;
          }
  
          // No source is set, see if we can find a standard match
          $matchAttributes = config('cms-models.analyzer.reference.sources', []);
          
          foreach ($matchAttributes as $matchAttribute) {
  
              if (array_key_exists($matchAttribute, $this->info->attributes)) {
                  $this->info->reference->source = $matchAttribute;
                  break;
              }
          }
  
          return $this;
      }
code: protected function setReferenceSource()
      {
          if (null !== $this->info->reference->source) {
              return $this;
          }
  
          // No source is set, see if we can find a standard match
          $matchAttributes = config('cms-models.analyzer.reference.sources', []);
          
          foreach ($matchAttributes as $matchAttribute) {
  
              if (array_key_exists($matchAttribute, $this->info->attributes)) {
                  $this->info->reference->source = $matchAttribute;
                  break;
              }
          }
  
          return $this;
      }
code_tokens: protected function setReferenceSource ( ) { if ( null !== $ this -> info -> reference -> source ) { return $ this ; } // No source is set, see if we can find a standard match $ matchAttributes = config ( 'cms-models.analyzer.reference.sources' , [ ] ) ; foreach ( $ matchAttributes as $ matchAttribute ) { if ( array_key_exists ( $ matchAttribute , $ this -> info -> attributes ) ) { $ this -> info -> reference -> source = $ matchAttribute ; break ; } } return $ this ; }
docstring: Sets default reference source, better than primary key, if possible.
  
  @return $this
docstring_tokens: Sets default reference source better than primary key if possible .