Skip to content

Commit

Permalink
Add rekey function in segments trait
Browse files Browse the repository at this point in the history
  • Loading branch information
senaranya committed Feb 10, 2025
1 parent 1bce8b5 commit fda03b7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/HL7/SegmentManagerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,15 @@ public function reindexSegments(): void
}
}

/**
* After removing segments from the middle of the message, $msg->getSemgnets() returns an array with gaps in the
* keys. This method can be used to re-key the segments array
*/
public function rekeySegmentsInArray(): void
{
$this->segments = array_values($this->segments);
}

/**
* Return the first segment of the given class in the message
*
Expand Down

0 comments on commit fda03b7

Please sign in to comment.