Allows customization of Messages on-the-fly.

package Swift
subpackage Plugins
author Chris Corbyn
author Fabien Potencier

 Methods

Create a new DecoratorPlugin with $replacements.

__construct(mixed $replacements) 

The $replacements can either be an associative array, or an implementation of Swift_Plugins_Decorator_Replacements.

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 Swift_Plugins_Decorator_Replacements, the object should return just the array of replacements for the address given to Swift_Plugins_Decorator_Replacements::getReplacementsFor().

Parameters

$replacements

mixed

Array or Swift_Plugins_Decorator_Replacements

Invoked immediately before the Message is sent.

beforeSendPerformed(\Swift_Events_SendEvent $evt) 

Parameters

Find a map of replacements for the address.

getReplacementsFor(string $address) : array

If this plugin was provided with a delegate instance of Swift_Plugins_Decorator_Replacements 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

Returns

array

Invoked immediately after the Message is sent.

sendPerformed(\Swift_Events_SendEvent $evt) 

Parameters

Sets replacements.

setReplacements(mixed $replacements) 
see \__construct()

Parameters

$replacements

mixed

Array or Swift_Plugins_Decorator_Replacements

Restore a changed message back to its original state

_restoreMessage(\Swift_Mime_Message $message) 

Parameters

$message

 Properties

 

$_lastMessage 
 

$_originalBody 
 

$_originalChildBodies 
 

$_originalHeaders 
 

$_replacements