\Metroplex\EdifactMessage

Represent an EDI message for both reading and writing.

Summary

Methods
Properties
Constants
fromFile()
fromString()
fromSegments()
getAllSegments()
getSegments()
getSegment()
addSegments()
addSegment()
serialize()
__toString()
No public properties found
No constants found
No protected methods found
$segments
N/A
No private methods found
No private properties found
N/A

Properties

$segments

$segments : array<mixed,\Metroplex\Edifact\Segment>

Type

array<mixed,\Metroplex\Edifact\Segment> — The segments that make up this message.

Methods

fromFile()

fromFile(string  $file) : static

Create a new instance from a file.

Parameters

string $file

The full path to a file that contains an EDI message

Returns

static

fromString()

fromString(string  $string) : static

Create a new instance from a string.

Parameters

string $string

The EDI message content

Returns

static

fromSegments()

fromSegments(array<mixed,\Metroplex\Edifact\Segment>  $segments) : static

Create a new instance from an array of segments.

Parameters

array<mixed,\Metroplex\Edifact\Segment> $segments

The segments of the message

Returns

static

getAllSegments()

getAllSegments() : array<mixed,\Metroplex\Edifact\Segment>

Get all the segments.

Returns

array<mixed,\Metroplex\Edifact\Segment>

getSegments()

getSegments(string  $name) : array<mixed,\Metroplex\Edifact\Segment>

Get all the segments that match the requested name.

Parameters

string $name

The name of the segment to return

Returns

array<mixed,\Metroplex\Edifact\Segment>

getSegment()

getSegment(string  $name) : \Metroplex\Edifact\Segment

Get the first segment that matches the requested name.

Parameters

string $name

The name of the segment to return

Returns

\Metroplex\Edifact\Segment

addSegments()

addSegments(array<mixed,\Metroplex\Edifact\Segment>  $segments) : static

Add multiple segments to the message.

Parameters

array<mixed,\Metroplex\Edifact\Segment> $segments

The segments to add

Returns

static

addSegment()

addSegment(\Metroplex\Edifact\Segment  $segment) : static

Add a segment to the message.

Parameters

\Metroplex\Edifact\Segment $segment

The segment to add

Returns

static

serialize()

serialize() : string

Serialize all the segments added to this object.

Returns

string

__toString()

__toString() : string

Allow the object to be serialized by casting to a string.

Returns

string