public function get($id_or_external_id) {
    $key = is_int($id_or_external_id) ? 'id' : 'external_id';
    foreach ($this as $item) {
      if ($item->{$key} === $id_or_external_id) {
        return $item;
      }
    }
    return null;
  }
public function get($id_or_external_id) {
    $key = is_int($id_or_external_id) ? 'id' : 'external_id';
    foreach ($this as $item) {
      if ($item->{$key} === $id_or_external_id) {
        return $item;
      }
    }
    return null;
  }
public function get ( $ id_or_external_id ) { $ key = is_int ( $ id_or_external_id ) ? 'id' : 'external_id' ; foreach ( $ this as $ item ) { if ( $ item -> { $ key } === $ id_or_external_id ) { return $ item ; } } return null ; }
Get object in the collection by id or external_id.
Get object in the collection by id or external_id .