Parser
in package
implements
ParserInterface
FinalYes
Parse EDI messages into an array of segments.
Table of Contents
Interfaces
Properties
Methods
- __construct() : mixed
- Create a new instance.
- parse() : iterable<string|int, SegmentInterface>
- Parse the message into an array of segments.
- convertTokensToSegments() : iterable<string|int, SegmentInterface>
- Convert the tokenized message into an array of segments.
- getControlCharacters() : CharactersInterface
- Read (and remove) the UNA segment from the passed string.
- produceSegment() : SegmentInterface
Properties
$factory
private
FactoryInterface
$factory
$tokenizer
private
TokenizerInterface
$tokenizer
Methods
__construct()
Create a new instance.
public
__construct([FactoryInterface|null $factory = null ][, TokenizerInterface|null $tokenizer = null ]) : mixed
Parameters
- $factory : FactoryInterface|null = null
- $tokenizer : TokenizerInterface|null = null
parse()
Parse the message into an array of segments.
public
parse(string $message[, CharactersInterface|null $characters = null ]) : iterable<string|int, SegmentInterface>
Parameters
- $message : string
- $characters : CharactersInterface|null = null
Tags
Return values
iterable<string|int, SegmentInterface>convertTokensToSegments()
Convert the tokenized message into an array of segments.
private
convertTokensToSegments(array<string|int, Token> $tokens, CharactersInterface $characters) : iterable<string|int, SegmentInterface>
Parameters
- $tokens : array<string|int, Token>
-
The tokens that make up the message
- $characters : CharactersInterface
Tags
Return values
iterable<string|int, SegmentInterface>getControlCharacters()
Read (and remove) the UNA segment from the passed string.
private
getControlCharacters(string &$message[, CharactersInterface|null $characters = null ]) : CharactersInterface
Parameters
- $message : string
- $characters : CharactersInterface|null = null
Return values
CharactersInterfaceproduceSegment()
private
produceSegment(array<string|int, mixed> $elements, CharactersInterface $characters) : SegmentInterface
Parameters
- $elements : array<string|int, mixed>
- $characters : CharactersInterface