1 | <?php |
||
20 | final class ManipulatorPlugin implements \Swift_Events_SendListener |
||
21 | { |
||
22 | /** |
||
23 | * @var EngineInterface |
||
24 | */ |
||
25 | private $templating; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $prependSubject; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $prependBodyTemplate; |
||
36 | |||
37 | /** |
||
38 | * @var string The original subject before manipulations |
||
39 | */ |
||
40 | private $originalSubject; |
||
41 | |||
42 | /** |
||
43 | * @var string The original body before manipulations |
||
44 | */ |
||
45 | private $originalBody; |
||
46 | |||
47 | /** |
||
48 | * @var \Swift_Mime_Message The message that was last replaced |
||
49 | */ |
||
50 | private $lastMessage; |
||
51 | |||
52 | /** |
||
53 | * @param EngineInterface $templating |
||
54 | * @param string $prependSubject |
||
55 | * @param string $prependBodyTemplate |
||
56 | */ |
||
57 | 10 | public function __construct(EngineInterface $templating, $prependSubject, $prependBodyTemplate) |
|
63 | |||
64 | 10 | public function beforeSendPerformed(\Swift_Events_SendEvent $event) |
|
74 | |||
75 | /** |
||
76 | * @param Swift_Events_SendEvent $event |
||
77 | */ |
||
78 | 10 | public function sendPerformed(Swift_Events_SendEvent $event) |
|
82 | |||
83 | /** |
||
84 | * @param \Swift_Mime_Message $message |
||
85 | */ |
||
86 | 10 | private function prependSubject(\Swift_Mime_Message $message) |
|
98 | |||
99 | /** |
||
100 | * @param \Swift_Mime_Message $message |
||
101 | */ |
||
102 | 10 | private function prependBodyWithTemplate(\Swift_Mime_Message $message) |
|
114 | |||
115 | /** |
||
116 | * Restore a changed message back to its original state. |
||
117 | * |
||
118 | * @param \Swift_Mime_Message $message |
||
119 | */ |
||
120 | 10 | private function restoreMessage(\Swift_Mime_Message $message) |
|
136 | } |
||
137 |