Skip to content

Commit

Permalink
Add ability to skip auto-incrementing index values
Browse files Browse the repository at this point in the history
  • Loading branch information
senaranya authored and Aranya Sen committed Jul 29, 2019
1 parent 062cf7a commit 0889117
Show file tree
Hide file tree
Showing 15 changed files with 218 additions and 83 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</p>

**Important: Supported PHP version has been updated to 7.2+. To use this package with 7.0 or 7.1, use previous release [1.5.4](https://github.com/senaranya/HL7/tree/1.5.4)**
**Important: Exception message for invalid segment name changed to "Segment name '$name' should be 3 characters and in uppercase"**

## Introduction

Expand Down Expand Up @@ -58,6 +59,12 @@ unset $pid; // Destroy the segment and decrement the id number. Useful when you
// Use 4th argument as true, or call resetSegmentIndices() on $msg object to reset segment indices to 1
$msg = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|", null, true, true);
// ... any segments added here will now start index from 1, as expected.
```
```php
// Sometimes you may want to have exact index values, rather than auto-incrementing for each instance of a segment
// Use 5th argument as false...
$hl7String = "MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "OBX|1||11^AA|\n" . "OBX|1||22^BB|\n";
$msg = new Message($hl7String, null, true, true, false); // $msg contains both OBXs with given indexes in the string
```
```php
// Create a segment with empty sub-fields retained
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^8"
"phpunit/phpunit": "^8",
"dms/phpunit-arraysubset-asserts": "^0.1.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 0889117

Please sign in to comment.