Swift_Plugins_DecoratorPlugin
in package
implements
Swift_Events_SendListener, Swift_Plugins_Decorator_Replacements
Allows customization of Messages on-the-fly.
Tags
Interfaces, Classes and Traits
- Swift_Events_SendListener
- Listens for Messages being sent from within the Transport system.
- Swift_Plugins_Decorator_Replacements
- Allows customization of Messages on-the-fly.
Table of Contents
- $lastMessage : mixed
- The Message that was last replaced
- $originalBody : mixed
- The body as it was before replacements
- $originalChildBodies : mixed
- Bodies of children before they are replaced
- $originalHeaders : mixed
- The original headers of the message, before replacements
- $replacements : mixed
- The replacement map
- __construct() : mixed
- Create a new DecoratorPlugin with $replacements.
- beforeSendPerformed() : mixed
- Invoked immediately before the Message is sent.
- getReplacementsFor() : array<string|int, mixed>
- Find a map of replacements for the address.
- sendPerformed() : mixed
- Invoked immediately after the Message is sent.
- setReplacements() : mixed
- Sets replacements.
- restoreMessage() : mixed
- Restore a changed message back to its original state
Properties
$lastMessage
The Message that was last replaced
private
mixed
$lastMessage
$originalBody
The body as it was before replacements
private
mixed
$originalBody
$originalChildBodies
Bodies of children before they are replaced
private
mixed
$originalChildBodies
= []
$originalHeaders
The original headers of the message, before replacements
private
mixed
$originalHeaders
= []
$replacements
The replacement map
private
mixed
$replacements
Methods
__construct()
Create a new DecoratorPlugin with $replacements.
public
__construct(mixed $replacements) : mixed
The $replacements can either be an associative array, or an implementation of .
When using an array, it should be of the form:
$replacements = array(
"address1@domain.tld" => array("{a}" => "b", "{c}" => "d"),
"address2@domain.tld" => array("{a}" => "x", "{c}" => "y")
)
When using an instance of , the object should return just the array of replacements for the address given to .
Parameters
- $replacements : mixed
-
Array or Swift_Plugins_Decorator_Replacements
Return values
mixed —beforeSendPerformed()
Invoked immediately before the Message is sent.
public
beforeSendPerformed(Swift_Events_SendEvent $evt) : mixed
Parameters
- $evt : Swift_Events_SendEvent
Return values
mixed —getReplacementsFor()
Find a map of replacements for the address.
public
getReplacementsFor(string $address) : array<string|int, mixed>
If this plugin was provided with a delegate instance of then the call will be delegated to it. Otherwise, it will attempt to find the replacements from the array provided in the constructor.
If no replacements can be found, an empty value (NULL) is returned.
Parameters
- $address : string
Return values
array<string|int, mixed> —sendPerformed()
Invoked immediately after the Message is sent.
public
sendPerformed(Swift_Events_SendEvent $evt) : mixed
Parameters
- $evt : Swift_Events_SendEvent
Return values
mixed —setReplacements()
Sets replacements.
public
setReplacements(mixed $replacements) : mixed
Parameters
- $replacements : mixed
-
Array or Swift_Plugins_Decorator_Replacements
Tags
Return values
mixed —restoreMessage()
Restore a changed message back to its original state
private
restoreMessage(Swift_Mime_SimpleMessage $message) : mixed
Parameters
- $message : Swift_Mime_SimpleMessage