class TokenProcessor

Properties

array $context
protected EventDispatcherInterface $dispatcher
protected array $messages
array $rowContexts DO NOT access field this directly. Use TokenRow. This is marked as public only to benefit TokenRow.
array $rowValues DO NOT access field this directly. Use TokenRow. This is marked as public only to benefit TokenRow.
protected array $tokens A list of available tokens
protected $next

Methods

__construct(EventDispatcherInterface $dispatcher, array $context)

No description

addMessage(string $name, string $value, string $format)

Register a string for which we'll need to merge in tokens.

addRow()

Add a row of data.

addToken(array $params)

No description

array
getMessage(string $name)

No description

array
getMessageTokens()

Get a list of all tokens used in registered messages.

getRow($key)

No description

Traversable
getRows()

No description

array
getTokens()

Get the list of available tokens.

evaluate()

Compute and store token values.

string
render(string $name, TokenRow|int $row)

Render a message.

Details

at line 77
__construct(EventDispatcherInterface $dispatcher, array $context)

Parameters

EventDispatcherInterface $dispatcher
array $context

at line 93
TokenProcessor addMessage(string $name, string $value, string $format)

Register a string for which we'll need to merge in tokens.

Parameters

string $name Ex: 'subject', 'body_html'.
string $value Ex: '

Hello {contact.name}

'.

string $format Ex: 'text/html'.

Return Value

TokenProcessor

at line 107
TokenRow addRow()

Add a row of data.

Return Value

TokenRow

at line 126
TokenProcessor addToken(array $params)

Parameters

array $params Array with keys: - entity: string, e.g. "profile". - field: string, e.g. "viewUrl". - label: string, e.g. "Default Profile URL (View Mode)".

Return Value

TokenProcessor

at line 139
array getMessage(string $name)

Parameters

string $name

Return Value

array Keys: - string: Unprocessed message (eg "Hello, {display_name}."). - format: Media type (eg "text/plain").

at line 148
array getMessageTokens()

Get a list of all tokens used in registered messages.

Return Value

array

at line 160
getRow($key)

Parameters

$key

at line 167
Traversable getRows()

Return Value

Traversable

at line 177
array getTokens()

Get the list of available tokens.

Return Value

array Ex: $tokens['event'] = array('location', 'start_date', 'end_date').

at line 189
evaluate()

Compute and store token values.

at line 205
string render(string $name, TokenRow|int $row)

Render a message.

Parameters

string $name The name previously registered with addMessage().
TokenRow|int $row The object or ID for the row previously registered with addRow().

Return Value

string Fully rendered message, with tokens merged.