original_string: public function getReferencesForModels($models, $strategy = null, $source = null)
      {
          $references = new Collection;
  
          if ( ! count($models)) {
              return $references;
          }
  
          /** @var Model $firstModel */
          if ($models instanceof Collection) {
              $firstModel = $models->first();
          } else {
              $firstModel = head($models);
          }
  
          $strategy = $this->determineModelReferenceStrategy($firstModel, $strategy);
  
          if ( ! $source) {
              $source = $this->determineModelReferenceSource($firstModel);
          }
  
          foreach ($models as $model) {
  
              if ( ! $strategy) {
                  $references->put($model->getKey(), $this->getReferenceFallback($model));
                  continue;
              }
  
              $references->put($model->getKey(), $strategy->render($model, $source));
          }
  
          return $references;
      }
code: public function getReferencesForModels($models, $strategy = null, $source = null)
      {
          $references = new Collection;
  
          if ( ! count($models)) {
              return $references;
          }
  
          /** @var Model $firstModel */
          if ($models instanceof Collection) {
              $firstModel = $models->first();
          } else {
              $firstModel = head($models);
          }
  
          $strategy = $this->determineModelReferenceStrategy($firstModel, $strategy);
  
          if ( ! $source) {
              $source = $this->determineModelReferenceSource($firstModel);
          }
  
          foreach ($models as $model) {
  
              if ( ! $strategy) {
                  $references->put($model->getKey(), $this->getReferenceFallback($model));
                  continue;
              }
  
              $references->put($model->getKey(), $strategy->render($model, $source));
          }
  
          return $references;
      }
code_tokens: public function getReferencesForModels ( $ models , $ strategy = null , $ source = null ) { $ references = new Collection ; if ( ! count ( $ models ) ) { return $ references ; } /** @var Model $firstModel */ if ( $ models instanceof Collection ) { $ firstModel = $ models -> first ( ) ; } else { $ firstModel = head ( $ models ) ; } $ strategy = $ this -> determineModelReferenceStrategy ( $ firstModel , $ strategy ) ; if ( ! $ source ) { $ source = $ this -> determineModelReferenceSource ( $ firstModel ) ; } foreach ( $ models as $ model ) { if ( ! $ strategy ) { $ references -> put ( $ model -> getKey ( ) , $ this -> getReferenceFallback ( $ model ) ) ; continue ; } $ references -> put ( $ model -> getKey ( ) , $ strategy -> render ( $ model , $ source ) ) ; } return $ references ; }
docstring: Returns list of references for a collection of model instances.
  
  Note: all models must be the same class!
  
  @param \ArrayAccess|Model[] $models
  @param string|null          $strategy
  @param string|null          $source
  @return Collection|string[]  reference values, keyed by model key
docstring_tokens: Returns list of references for a collection of model instances .