1 | <?php |
||
26 | final class Transport implements Swift_Transport |
||
27 | { |
||
28 | /** |
||
29 | * @var Swift_Events_EventDispatcher |
||
30 | */ |
||
31 | private $eventDispatcher; |
||
32 | |||
33 | /** |
||
34 | * @var SparkPost |
||
35 | */ |
||
36 | private $sparkpost; |
||
37 | |||
38 | /** |
||
39 | * @var PayloadBuilderInterface |
||
40 | */ |
||
41 | private $payloadBuilder; |
||
42 | |||
43 | /** |
||
44 | * @param string $apiKey |
||
45 | * |
||
46 | * @return Transport |
||
47 | */ |
||
48 | 3 | public static function newInstance($apiKey) |
|
56 | |||
57 | /** |
||
58 | * @param Swift_Events_EventDispatcher $eventDispatcher |
||
59 | * @param SparkPost $sparkpost |
||
60 | * @param PayloadBuilderInterface $payloadBuilder |
||
61 | */ |
||
62 | 36 | public function __construct( |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 3 | public function isStarted() |
|
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | 3 | public function start() |
|
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | 3 | public function stop() |
|
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | 27 | public function send(Swift_Mime_Message $message, &$failedRecipients = null) |
|
134 | |||
135 | /** |
||
136 | * {@inheritdoc} |
||
137 | */ |
||
138 | 3 | public function registerPlugin(Swift_Events_EventListener $plugin) |
|
142 | |||
143 | /** |
||
144 | * @param Swift_Mime_Message $message |
||
145 | * |
||
146 | * @return array |
||
147 | * @throws Swift_TransportException |
||
148 | */ |
||
149 | 24 | private function buildPayload(Swift_Mime_Message $message) |
|
160 | |||
161 | /** |
||
162 | * @param array $payload |
||
163 | * |
||
164 | * @return SparkPostResponse |
||
165 | * @throws Swift_TransportException |
||
166 | */ |
||
167 | 21 | private function sendTransmission(array $payload) |
|
185 | |||
186 | /** |
||
187 | * @param string $message |
||
188 | * @param AnyException $exception |
||
189 | * |
||
190 | * @return Swift_TransportException |
||
191 | */ |
||
192 | 6 | private function createAndDispatchTransportException($message, AnyException $exception) |
|
202 | } |
||
203 |