Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support array type for MSH Version ID #111

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/HL7/Segments/MSH.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public function getProcessingId(int $position = 11)
/**
* Get HL7 version, e.g. 2.1, 2.3, 3.0 etc.
*/
public function getVersionId(int $position = 12): string
public function getVersionId(int $position = 12): string|array
{
return $this->getField($position);
}
Expand Down
11 changes: 11 additions & 0 deletions tests/Segments/MSHTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ public function more_than_one_character_as_field_separator_is_not_accepted(): vo
self::assertSame('|', $msh->getField(1), 'MSH Field sep field (MSH(1))');
}

/** @test */
public function version_id_can_be_string_or_array_for_v2_7_onwards(): void
{
$msh = new MSH();
$msh->setVersionId('2.3');
self::assertSame('2.3', $msh->getVersionId());

$msh->setVersionId(['2.7', 'NZL', '1.0']);
self::assertSame(['2.7', 'NZL', '1.0'], $msh->getVersionId());
}

/** @test */
public function index_2_in_MSH_accepts_only_4_character_strings(): void
{
Expand Down