Message
in package
implements
MessageInterface
FinalYes
Represent an EDI message for both reading and writing.
Table of Contents
Interfaces
Properties
- $segments : array<string|int, SegmentInterface>
Methods
- __toString() : mixed
- Allow the object to be serialized by casting to a string.
- addSegment() : $this
- Add a segment to the message.
- addSegments() : $this
- Add multiple segments to the message.
- fromFile() : self
- Create a new instance from a file.
- fromSegments() : self
- Create a new instance from an array of segments.
- fromString() : self
- Create a new instance from a string.
- getAllSegments() : array<string|int, SegmentInterface>
- Get all the segments.
- getSegment() : SegmentInterface|null
- Get the first segment that matches the requested code.
- getSegments() : iterable<string|int, SegmentInterface>
- Get all the segments that match the requested code.
- serialize() : string
- Serialize all the segments added to this object.
Properties
$segments
private
array<string|int, SegmentInterface>
$segments
= []
The segments that make up this message.
Methods
__toString()
Allow the object to be serialized by casting to a string.
public
__toString() : mixed
addSegment()
Add a segment to the message.
public
addSegment(SegmentInterface $segment) : $this
Parameters
- $segment : SegmentInterface
Return values
$thisaddSegments()
Add multiple segments to the message.
public
addSegments(SegmentInterface ...$segments) : $this
Parameters
- $segments : SegmentInterface
Return values
$thisfromFile()
Create a new instance from a file.
public
static fromFile(string $file) : self
Parameters
- $file : string
-
The full path to a file that contains an EDI message
Tags
Return values
selffromSegments()
Create a new instance from an array of segments.
public
static fromSegments(SegmentInterface ...$segments) : self
Parameters
- $segments : SegmentInterface
Return values
selffromString()
Create a new instance from a string.
public
static fromString(string $string) : self
Parameters
- $string : string
Tags
Return values
selfgetAllSegments()
Get all the segments.
public
getAllSegments() : array<string|int, SegmentInterface>
Return values
array<string|int, SegmentInterface>getSegment()
Get the first segment that matches the requested code.
public
getSegment(string $code) : SegmentInterface|null
Parameters
- $code : string
Return values
SegmentInterface|nullgetSegments()
Get all the segments that match the requested code.
public
getSegments(string $code) : iterable<string|int, SegmentInterface>
Parameters
- $code : string
Return values
iterable<string|int, SegmentInterface>serialize()
Serialize all the segments added to this object.
public
serialize() : string