Class Swift_Plugins_DecoratorPlugin

InheritanceSwift_Plugins_DecoratorPlugin
ImplementsSwift_Events_SendListener, Swift_Plugins_Decorator_Replacements

Allows customization of Messages on-the-fly.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Create a new DecoratorPlugin with $replacements. Swift_Plugins_DecoratorPlugin
beforeSendPerformed() Invoked immediately before the Message is sent. Swift_Plugins_DecoratorPlugin
getReplacementsFor() Find a map of replacements for the address. Swift_Plugins_DecoratorPlugin
sendPerformed() Invoked immediately after the Message is sent. Swift_Plugins_DecoratorPlugin
setReplacements() Sets replacements. Swift_Plugins_DecoratorPlugin

Method Details

__construct() public method

Create a new DecoratorPlugin with $replacements.

The $replacements can either be an associative array, or an implementation of {@link 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 {@link Swift_Plugins_Decorator_Replacements}, the object should return just the array of replacements for the address given to {@link Swift_Plugins_Decorator_Replacements::getReplacementsFor()}.

public void __construct ( $replacements )
$replacements mixed

Array or Swift_Plugins_Decorator_Replacements

beforeSendPerformed() public method

Invoked immediately before the Message is sent.

public void beforeSendPerformed ( Swift_Events_SendEvent $evt )
$evt Swift_Events_SendEvent
getReplacementsFor() public method

Find a map of replacements for the address.

If this plugin was provided with a delegate instance of {@link 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.

public array getReplacementsFor ( $address )
$address string
sendPerformed() public method

Invoked immediately after the Message is sent.

public void sendPerformed ( Swift_Events_SendEvent $evt )
$evt Swift_Events_SendEvent
setReplacements() public method

Sets replacements.

See also __construct().

public void setReplacements ( $replacements )
$replacements mixed

Array or Swift_Plugins_Decorator_Replacements